Code-Func:传递的字符串中数字字符的数目

时间:2020-04-11
本文章向大家介绍Code-Func:传递的字符串中数字字符的数目,主要包括Code-Func:传递的字符串中数字字符的数目使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
ylbtech-Code-Func:传递的字符串中数字字符的数目
1.返回顶部
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;
        }
    }
}
2、
2.返回顶部
3.返回顶部
4.返回顶部
5.返回顶部
6.返回顶部
作者:ylbtech
出处:http://ylbtech.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。

原文地址:https://www.cnblogs.com/storebook/p/12680957.html