110,546
社区成员
发帖
与我相关
我的任务
分享
public static IList<int> GetNumberic(string str)
{
IList<int> numbericList=new List<int>();
MatchCollection ms = Regex.Matches(str, @"\d+");
foreach(Match m in ms)
{
numbericList.Add(m.Value);
}
return numbericList;
}
public static IList<string> GetStrings(string str)
{
IList<string> strList=new List<string>();
MatchCollection ms = Regex.Matches(str, @"\D+");
foreach(Match m in ms)
{
strList.Add(m.Value);
}
return strList;
}
//提取数字
MatchCollection ms = Regex.Matches(str, @"\d+");
//提取非数字
MatchCollection ms = Regex.Matches(str, @"\D+");
foreach (Match m in ms) ==>>> m.Value