string aa = "abc";
if (aa.IndexOf("abc") > 0)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("2");
}
Console.ReadLine();
为什么始终是输出2 而不是1呢 如何才能得到1的结果
if (aa.IndexOf("abc") > 0)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("2");
}
Console.ReadLine();
为什么始终是输出2 而不是1呢 如何才能得到1的结果
{
Console.WriteLine("1");
}
string aa = "abc";
if (aa.IndexOf("abc") >= 0)
{
Console.WriteLine("1");
}
else
{
Console.WriteLine("2");
}
Console.ReadLine();
C#中序号是从0开始的。
http://baike.baidu.com/view/1674560.htm?fr=ala0
Contains:是否包含某个字符串