标识符

/*
 * 由SharpDevelop创建。
 * 用户: Administrator
 * 日期: 2018/10/20
 * 时间: 12:22
 * 
 * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件
 */
using System;

namespace C工资1
{
    class Program
    {
        public static void Main(string[] args)
        {
            
                string str=Console.ReadLine();
            bool isRinght=true;
            if ((str[0]>='a'&&str[0]<='z' ) ||(str[0]>='A'&&str[0]<='Z')||(str[0]>='_')||(str[0]<='@')) {
            
            }else{
                isRinght=false;
            }
            for (int i = 1; i < str .Length ; i++) {
                if ((str[i]>='a'&&str[i]<='z' ) ||(str[i]>='A'&&str[i]<='Z')||str[i]>='_'||(str[i]>='0'&&str[i]<='9')) {
                    
                }else{
                isRinght=false;
                }
            }
            if (isRinght=false) {
                    Console.WriteLine("不是合法的标识符");
            }else{
            
            Console.WriteLine("是合法的标识符");
            
            }
            Console.ReadKey();
        }

    }

}

asdfd

合法的标识符

原文地址:https://www.cnblogs.com/llhhcc/p/9821444.html