码迷,mamicode.com
首页 > Windows程序 > 详细

c# 判断字符串是否为数字

时间:2014-11-05 16:51:19      阅读:172      评论:0      收藏:0      [点我收藏+]

标签:ar   os   sp   bs   tt   nbsp   字符串   c   c#   

float floattemp=0;

float.TryParse(kf, out floattemp) true则是数字,false则不为数字

控制小数点位数

 strLength = floattemp.ToString().Split(‘.‘);

strTemp = strLength[1];
if (strTemp.Length > 2)
{
err += "高考总分小数点后部分超过2位;";
}

c# 判断字符串是否为数字

标签:ar   os   sp   bs   tt   nbsp   字符串   c   c#   

原文地址:http://www.cnblogs.com/miraclesakura/p/4076418.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!