public string IsNum(String str)
{
string ss="";
for (int i = 0; i < str.Length; i++)
{
if (Char.IsNumber(str, i) == true)
{
ss += str.Substring(i, 1);
}
else
{
if (str.Substring(i, 1) == ",")
{
ss += str.Substring(i, 1);
}
}
}
return ss;
}
Console.Write(IsNum("aaa139504928bbb11ccc,888"));//你们看下效果就知道了.
|