-
搜寻“C#入门经典教程”这一字符串
资源介绍
搜索字符串
[n]
string poem = “Kubla Khan”;
poem[0];
IndexOf, LastIndexOf(string, [int start], [int count])
int n=poem.IndexOf(“la”);
n=poem.IndexOf(‘K’,4);
IndexOfAny, LastIndexOf
char[] chs = {‘a’, ‘e’, ‘i’, ‘o’, ‘u’};
N=poem.IndexOfAny(chs);
N=poem.LastIndexOfAny(chs,2);
如果没找到,返回-1