我有这个数字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] 删除。
我来说两句