更新时间:2022-08-15 13:41:17
ylbtech-Unitity-cs:传递的字符串中数字字符的数目 |
1.A,效果图返回顶部 |
1.B,源代码返回顶部 |
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; } } }