List of utility methods to do Locale Format
String | formatNumber(Number num) format Number return getNumberFormat().format(num);
|
String | formatNumber(Number number) format Number NumberFormat format = NumberFormat.getNumberInstance(Locale.getDefault());
return format.format(number);
|
String | formatNumber(Number value, int minDecimals, int maxDecimals, boolean grouping, boolean dotDecimalSymbol) format Number DecimalFormat formatter = new DecimalFormat(); formatter.setMinimumFractionDigits(minDecimals); formatter.setMaximumFractionDigits(maxDecimals); if (dotDecimalSymbol) { formatter.setDecimalFormatSymbols(new DecimalFormatSymbols(Locale.US)); formatter.setGroupingUsed(grouping); return formatter.format(value); ... |
String | formatNumber(Number value, String format) Formats an arbitrary numeric object according to the current locale. return getNumberFormatter(format).format(value);
|
String | formatNumber(Object number, String pattern, Locale locale) format number by pattern and locale if (number instanceof String) { return (String) number; DecimalFormatSymbols decimalFormatSymbols = new DecimalFormatSymbols(locale); NumberFormat parser = new DecimalFormat(pattern, decimalFormatSymbols); return parser.format(number); |
String | formatNumber(Object value, Locale locale) format Number NumberFormat nf = NumberFormat.getNumberInstance(locale); String sval = new String(value.toString()); if (sval.contains("(")) { String[] split = sval.split("\\("); sval = split[1]; if (sval.contains(")")) { String[] split = sval.split("\\)"); ... |
String | formatNumber(Object value, String numberFormat) Format a number using a valid Java format mask and the default Locale DecimalFormat fmt = (DecimalFormat) NumberFormat.getInstance();
fmt.applyPattern(numberFormat);
return fmt.format(value);
|
String | formatNumberSameWidth(final double v) Format a given number for output return FORMATTER.format(v);
|
String | formatNumberUk(double inNumber, int inDecimalPlaces) Format the given number in UK format (decimal point) to the given number of decimal places UK_FORMAT.setMaximumFractionDigits(inDecimalPlaces);
UK_FORMAT.setMinimumFractionDigits(inDecimalPlaces);
return UK_FORMAT.format(inNumber);
|
String | formatNumberWithThousandSeparator(long number) format Number With Thousand Separator BigDecimal bd = new BigDecimal(number); NumberFormat formatter = NumberFormat.getInstance(Locale.US); return formatter.format(bd.longValue()); |