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

float floattemp=0;

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

控制小数点位数

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

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

posted @ 2014-11-05 15:05  樱花飞落ll  阅读(914)  评论(0)    收藏  举报