/// <summary> /// 判断是否是非法字符 /// </summary> /// <param name="str">判断是字符</param> /// <returns></returns> protected static Boolean isLegalNumber(string str) { char[] charStr = str.ToLower().ToCharArray(); if (charStr[0] == '0') { return false; } for (int i = 0; i < charStr.Length; i++) { int num = Convert.ToInt16(charStr[i]); if (!(num >= 48 && num <= 57)) { return false; } } return true; }