/// <summary>
/// 验证合法输入 (.0123456789)
/// </summary>
/// <param name="strCode">待验证字符串</param>
/// <returns></returns>
public bool IsNumeric(string strCode)
{
if (strCode == null || strCode.Length == 0)
return false;
ASCIIEncoding ascii = new ASCIIEncoding();
byte[] byteStr = ascii.GetBytes(strCode);
foreach (byte code in byteStr)
{
//验证 .--46 0--48 1--49 9--57
if (code < 46 || code > 57)
return false;
if (code ==47)
return false;
}
return true;
}
浙公网安备 33010602011771号