今晚,在上网百到了一个很简单而又很绝的办法:
String Str="123.4"; try { Convert.ToDecimal(tStr); MessageBox.Show("Str是数字"); //是数字 } catch (Exception) { MessageBox.Show("Str不是数字");//不是数字 }
可能还有想不到问题,等待大家的交流。
转载于:https://blog.51cto.com/liusu/1212265
今晚,在上网百到了一个很简单而又很绝的办法:
String Str="123.4"; try { Convert.ToDecimal(tStr); MessageBox.Show("Str是数字"); //是数字 } catch (Exception) { MessageBox.Show("Str不是数字");//不是数字 }
可能还有想不到问题,等待大家的交流。
转载于:https://blog.51cto.com/liusu/1212265