比如有一个list,其中的内容是
12323
abaa
d34
abc
kjk34
一、我现在想找开头为"ab"的那行(第一次匹配到头文字"ab"的那行),结果应该是1,怎样做?
用list.indexOf("abaa")只能精确查找二、我现在想找以"34"为结尾的那行(第一次匹配到尾文字为"34"的那行),结果应该返回2,怎样做?
12323
abaa
d34
abc
kjk34
一、我现在想找开头为"ab"的那行(第一次匹配到头文字"ab"的那行),结果应该是1,怎样做?
用list.indexOf("abaa")只能精确查找二、我现在想找以"34"为结尾的那行(第一次匹配到尾文字为"34"的那行),结果应该返回2,怎样做?
{
if(list[i].ToString().FirstIndexOf("ab"))
return i;
}
foreach(string s in list)
{
if(s.EndsWith("34"))
count++;
}
foreach(string s in list)
{
if(s.Substring(0,1)=="ab")
count++;
}