日期:2014-05-17 浏览次数:20449 次
string txt = "abcdef123der";
Console.WriteLine("数字的位置是:{0}", txt.IndexOf(Regex.Match(txt, @"\d+").Groups[0].Value));
string txt = "abcdef123der";
for (int i = 0; i < txt.Length; i++)
{
int parse;
if (int.TryParse(txt[i].ToString(),out parse))
{
Console.Write("位置:" + i.ToString());
break;
}
}