日期:2014-05-17  浏览次数:20998 次

新手求组,如何从一堆字符串中截取出数字
例如:

string s="stien2234sdfw3,567s,6977w"; 

我想把数字都截取出来,请问该怎么做啊?

------解决方案--------------------

string s = "stien2234sdfw3,567s,6977w";
MatchCollection ms=Regex.Matches(s, @"\d+");
foreach (Match m in ms) Console.WriteLine(m.Value);