ylbtech-Unitity-cs:传递的字符串中数字字符的数目

ylbtech-Unitity-cs:传递的字符串中数字字符的数目
1.A,效果图返回顶部
 
1.B,源代码返回顶部
1.B.1,
using System; 

namespace Functions 
{
    public class DigitCount 
    {
        // NumberOfDigits 静态方法计算
        // 传递的字符串中数字字符的数目:
        public static int NumberOfDigits(string theString) 
        {
            int count = 0; 
            for ( int i = 0; i < theString.Length; i++ ) 
            {
                if ( Char.IsDigit(theString[i]) ) 
                {
                    count++; 
                }
            }
            return count;
        }
    }
}
1.B.5,
1.C,下载地址返回顶部

warn 作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
原文地址:https://www.cnblogs.com/ylbtech/p/5062031.html