List of usage examples for java.text DecimalFormat DecimalFormat
public DecimalFormat(String pattern, DecimalFormatSymbols symbols)
From source file:com.insightaction.util.DataLoader.java
private static BigDecimal getBigDecimal(String value) { DecimalFormatSymbols symbols = new DecimalFormatSymbols(); symbols.setGroupingSeparator(','); symbols.setDecimalSeparator('.'); String pattern = "#,##0.0#"; DecimalFormat decimalFormat = new DecimalFormat(pattern, symbols); decimalFormat.setParseBigDecimal(true); BigDecimal bigDecimal = null; try {//from w w w . ja v a 2 s . c o m bigDecimal = (BigDecimal) decimalFormat.parse(value); } catch (ParseException e) { e.printStackTrace(); } return bigDecimal; }
From source file:com.haulmont.chile.core.datatypes.impl.BigDecimalDatatype.java
@Override public BigDecimal parse(String value, Locale locale) throws ParseException { if (StringUtils.isBlank(value)) { return null; }/* w ww . j a v a 2 s .c om*/ FormatStrings formatStrings = AppBeans.get(FormatStringsRegistry.class).getFormatStrings(locale); if (formatStrings == null) { return parse(value); } DecimalFormatSymbols formatSymbols = formatStrings.getFormatSymbols(); DecimalFormat format = new DecimalFormat(formatStrings.getDecimalFormat(), formatSymbols); format.setParseBigDecimal(true); return (BigDecimal) parse(value, format); }