List of utility methods to do Number Format Pattern
String | formatIntoCurr(String str_number, int digits) Use this method like this: String formatted = Util.formatIntoCurr("123456789.123", 2); formatted ==> "123,456,789.12" String pattern = "###,###"; double value = -1.; if (digits > 0) pattern += "."; for (int i = 0; i < digits; i++) { pattern += "#"; try { ... |
String | formatLong(long value) format Long NumberFormat formatter = new DecimalFormat("#,###,###"); return formatter.format(value); |
String | formatNumber(final long number) format Number DecimalFormat f = new DecimalFormat("#,###"); return f.format(number); |
String | formatNumber(final long number) format Number DecimalFormat f = new DecimalFormat("#,###"); return f.format(number); |
String | formatNumber(int num) format Number return intFormat_.format(num);
|
String | formatNumber(int source) format Number String pattern = "###,###"; DecimalFormat decimalFormat = new DecimalFormat(pattern); String format = decimalFormat.format(source); return format; |
String | formatNumber(long number) format Number return numberFormat.format(number);
|
String | formatNumber(long number) Formats a number, as a decimal number with at most 2 digits. return DECIMAL.format(number);
|
String | formatNumber(Number num) format Number return formatNumber(num, DEFAULT_NUMBER_FORMAT);
|
String | formatNumber(Number number) Examples: 1 -> 1 12d -> 12 123d -> 123 1234d -> 1.234E03 12345d -> 12.345E03 123.1234567890d -> 123.123457 1234.1234567890d -> 1.23412346E03 1.12345678901234567890d -> 1.12345679 12345.1234567890d -> 12.3451235E03 0.000000000001234567890d -> 1.23456789E-12 return nf.get().format(number).replace("E00", ""); |