获得数字个数
2017-01-26 20:34:53 访问(1387) 赞(0) 踩(0)
/// <summary>
/// 获得数字个数
/// </summary>
/// <param name="str">
/// <returns></returns>
public int StrGetNumber(string str)
{
if (str == null || str.Length == 0)
return 0;
int iLen = str.Length;
int theResult = 0;
for (int i = 0; i < iLen; ++i)
{
if (str[i] >= '0' && str[i] <= '9')
++theResult;
}
return theResult;
}
标签:
获得数字个数 


上一条:
下一条:
相关评论
发表评论