c#判断输入的是字母还是汉字

来源:互联网 发布:电脑触摸屏校正软件 编辑:程序博客网 时间:2024/04/28 05:43

北京博洋四海科技中心

 

using System;
using System.Collections.Generic;
using System.Text;

namespace exe_1
{
    class Program
    {
        static void Main(string[] args)
        {

            Console.WriteLine("请输入一个字符串");
            string a = Console.ReadLine();
            char[] b=a.ToCharArray();


           if (b[0] >= '0' && b[0] <= '9')
           Console.WriteLine("第一个字符是数字");
          else 
               if (b[0] >= 'A' && b[0] <= 'z')
         Console.WriteLine("第一个字符是字母");
      

        }
    }
}