System.Chare的成员

Posted on 2019-02-01 15:24  努力成长静待花开  阅读(152)  评论(0编辑  收藏  举报

实现效果:

  

知识运用:
  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('?'));
        }