如何把字符“23.00”转成int型!
convert,parse,都抱错!
“Input   string   was   not   in   a   correct   format.”
------解决方案--------------------------------------------------------
如果需要考虑四舍五入可以先转成double
string s= "23.00 ";
double dTemp=double.Parse(s);
int iTemp=Convert.ToInt32(dTemp);
如果不需要,就可以用
string s = "23.00 ";
s = s.Substring(0,s.IndexOf( '. '));
int i = int.Parse(s);

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-26
  • 2021-11-01
  • 2021-08-24
  • 2022-12-23
  • 2022-12-23
  • 2022-01-13
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-24
  • 2022-12-23
  • 2021-08-06
  • 2022-12-23
  • 2021-08-20
相关资源
相似解决方案