"提取字符串中为数字的字符串"#region "提取字符串中为数字的字符串"
/**//// <summary>
/// 提取字符串中为数字的字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
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;
}
#endregion
调用:
Response.Write(IsNum("aaa139504928bbb11ccc,888"));你们看下效果就知道对你们有用了.
/**//// <summary>
/// 提取字符串中为数字的字符串
/// </summary>
/// <param name="str"></param>
/// <returns></returns>
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;
}
#endregion
调用:
Response.Write(IsNum("aaa139504928bbb11ccc,888"));你们看下效果就知道对你们有用了.