日期:2014-05-18  浏览次数:20741 次

继续上次的问题。如果是全角怎么办?
如题
上一贴:http://community.csdn.net/Expert/topic/5732/5732206.xml?temp=.7683679

------解决方案--------------------
/// <summary>
/// Function to test whether the string is valid number or not.
/// </summary>
/// <param name= "str "> string. </param>
/// <returns> Return true if str is number. </returns>
public static bool IsNumber(String str)
{
return Regex.IsMatch(str, "(^[-]?[0-9]*[.]?[0-9]+$) ");
}

是否是数字


如果不是不让输入.