List of utility methods to do Number Format Pattern
String | FormatNumber(Object o, String patter) Format Number double d = 0; try { d = Double.parseDouble(String.valueOf(o)); DecimalFormat df = new DecimalFormat(patter); return df.format(d); } catch (Exception e) { System.out.println(e.getMessage()); return ""; ... |
String | formatoDecimalPunto(String numero) recibe de la base de datos un decimal de la forma 00000.00 o 00000 (sin decimales) y lo formatea de la forma 00000.00 if (!nullToBlank(numero).equals("")) { numero = numero.trim(); String s = "#########.##"; DecimalFormatSymbols dformater_rules = new DecimalFormatSymbols(); dformater_rules.setDecimalSeparator('.'); DecimalFormat decimalFormat = new DecimalFormat(s, dformater_rules); decimalFormat.setMaximumFractionDigits(2); decimalFormat.setMinimumFractionDigits(2); ... |
String | formatQuantity(Long quantity) Formats an Long representing a quantity into a string if (quantity == null) return ""; else return formatQuantity(quantity.doubleValue()); |
String | formattedDuration(long pStartTime) formatted Duration DecimalFormat df = new DecimalFormat("#,###,###,##0.000"); return df.format((System.currentTimeMillis() - pStartTime) / 1000.00); |
String | formatThousands(String inValue) format Thousands String value = inValue; try { value = DF_THOUSANDS.format(Long.parseLong(value)); } catch (NumberFormatException nfe) { return value; |
String | formatTime(long endTime, long startTime) format Time long milliseconds = endTime - startTime; return formatTime(milliseconds); |
String | formatTokens(long tokens) format Tokens return format.format(tokens);
|
String | formatValue(int value) format Value return new DecimalFormat("#, ###").format(value); |
String | formatValue(Object value) format Value if (value == null) { return "0"; if (value instanceof Long) { return String.valueOf((Long) value); } else if (value instanceof Double) { return formatSimpleDouble((Double) value); } else { ... |
double | formatWith6Digits(String input) format With Digits DecimalFormat df = new DecimalFormat("###.000000"); double input_double = Double.parseDouble(input); String result = df.format(input_double); double result_double = Double.parseDouble(result); return result_double; |