获得英文个数

2017-01-26 20:35:16  访问(1378) 赞(0) 踩(0)


    /// <summary>
    /// 获得英文个数
    /// </summary>
    /// <param name="str">
    /// <returns></returns>
    public int StrGetEn(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] >= 'a' && str[i] <= 'z')
            {
                ++theResult;
            }

            if (str[i] >= 'A' && str[i] <= 'Z')
            {
                ++theResult;
            }
        }

        return theResult;
    }


标签:获得英文个数 

上一条:

下一条:


 

相关评论

评论加载中……
 

发表评论

类型:
内容:
  (Alt+Enter)
 
  ┈全部┈  
 
(显示默认分类)