📄 digitcounter.cs
字号:
// DigitCounter.cs
// compile with: /target:library
using System;
// Declare the same namespace as the one in Factorial.cs. This simply
// allows types to be added to the same namespace.
namespace Functions
{
public class DigitCount
{
// The NumberOfDigits static method calculates the number of
// digit characters in the passed string:
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;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -