使用格式将字符串转换为int

法鲁克

我有这个数字3.445,我需要将其转换为int以便将其写入postgre数据库。这是我的代码:

NumberFormat numberFormat = NumberFormat.getInstance(Locale.UK);
numberOfEmployees = (Integer) numberFormat.parse(numberOfEmployeesString); 

注意:此数字是三千四百四十四。

艾利亚·加玛尔
  String bd = "3.445";///this is the string which you have 

  ////If you want the grouping separator to be a point, you can use an european locale:
  Number parse = NumberFormat.getNumberInstance(java.util.Locale.GERMAN).parse(bd);

  int n=parse.intValue();/// this is the integer value for your string

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章