Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使String.Contains()不区分大小写_String_Vb.net_Visual Studio 2010 - Fatal编程技术网

使String.Contains()不区分大小写

使String.Contains()不区分大小写,string,vb.net,visual-studio-2010,String,Vb.net,Visual Studio 2010,我在vb.net中制作了一个有特定用途的软件 它必须在一个特定点比较两个字符串,比如说它们是x和y。代码是 If x.Contains(y) then 'do things here End If 如果y是'Hello',x是'Hello there',那么根据我的要求,If语句必须为true,但事实证明Contains控件区分大小写 如何使其不区分大小写 编辑: 我的问题是在vb.net中,而不是在C中。虽然它们大部分都很相似,但我不懂C,也不知道如何在我的场景中实现答案,因为这两种语言是不

我在vb.net中制作了一个有特定用途的软件

它必须在一个特定点比较两个字符串,比如说它们是x和y。代码是

If x.Contains(y) then
'do things here
End If
如果y是'Hello',x是'Hello there',那么根据我的要求,If语句必须为true,但事实证明Contains控件区分大小写

如何使其不区分大小写

编辑:
我的问题是在vb.net中,而不是在C中。虽然它们大部分都很相似,但我不懂C,也不知道如何在我的场景中实现答案,因为这两种语言是不同的。因此,我的问题与前面提到的问题不同。

将x和y都设置为大写也可以

If x.IndexOf(y, StringComparison.CurrentCultureIgnoreCase) >= 0 Then
    'do nothing
End If
If x.ToUpper().Contains(y.ToUpper()) Then
'do things here
End If

@KashishArora-该框架由C和VB.Net共享,因此使用框架方法的解决方案将是相同的,没有微小的差异,例如VB没有以a;结尾的语句;。如果你不能在链接问题中使用C答案并使其在VB中运行,那么这将是一个你需要解决的一般问题,因为你更可能找到用C编写的通用解决方案,正如我所说的,框架对两者都是一样的。另一种情况是,提供解决方案。在某些情况下不起作用。请参见此处的评论: