c#中的字符串查找函数

indexOf()方法,查找某字符串在一个字符串内的位置,没有则返回-1
string aa="abcdef";
int a=aa.indexOf("bc");//a会等于1
int b=aa.indexOf("a");//b会等于0
int c=aa.indexOf("g");c会等于-1
所以你只要判断返回出来的int值是不是小于0就知道这个字符串里有没有包含指定的另一个字符串
原文地址:https://www.cnblogs.com/lengv10/p/3797023.html