新手求组,如何从一堆字符串中截取出数字
例如:
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);
发布时间: 2014-01-21 00:35:39 作者: rapoo
新手求组,如何从一堆字符串中截取出数字
例如:
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);