实现效果:
知识运用:
System.Char的静态方法 (判断一个给定的字符是否为数字 字母 标点符号或其他)
实现效果:
static void CharFunctionality() { Console.WriteLine("=> char type Functionality:"); char myChar = 'a'; Console.WriteLine("char IsDigit('a'): {0}",char.IsDigit(myChar)); Console.WriteLine("char IsLetter('a'): {0}",char.IsLetter(myChar)); Console.WriteLine("char IsWhiteSpace('Hello Word',5): {0}",char.IsWhiteSpace("Hello Word",5)); Console.WriteLine("char IsWhiteSpace('Hello Word',6): {0}", char.IsWhiteSpace("Hello Word", 6)); Console.WriteLine("char IsPunctuation('?'): {0}",char.IsPunctuation('?')); }