【发布时间】:2016-08-22 17:32:20
【问题描述】:
我想检查下面的字符串是否包含c#中的top/ TOP/toP/ Top/TOp/ Top。我的代码是这样的
string str = null;
str = "CSharp Top11111 10 BOOKS";
if (str.Contains("top") == true)
{
Console.WriteLine("The string Contains() 'TOP' ");
}
else
{
Console.WriteLine("The String does not Contains() 'TOP'");
}
但只有当我的字符串包含'top'时它才返回true。对于所有其他情况,如何返回 true 呢?我知道这可能很简单,但我搜索了很多没有找到任何解决方案
【问题讨论】:
标签: c#