List of utility methods to do Message Format
String | format(String pattern, Object... args) Format a given string pattern and a list of arguments as defined by MessageFormat
if (args != null && args.length > 0) { return MessageFormat.format(pattern, args); } else return String.valueOf(pattern); |
String | format(String pattern, String[] replacements) format return java.text.MessageFormat.format(pattern, (Object[]) replacements);
|
String | format(String str, int replacement) Formats the string with replacement values return MessageFormat.format(str, new Object[] { Integer.toString(replacement) }); |
String | format(String str, Object... arguments) Formats UI strings. str = str.replaceAll("'", "''"); return MessageFormat.format(str, arguments); |
String | format(String textPattern, Object... args) Formats the given String of text. return messageFormat(stringFormat(textPattern, args), args);
|
String | formatAsNumber(double value) format As Number BigDecimal valueOf = BigDecimal.valueOf(value); BigDecimal integerPart = BigDecimal.valueOf(valueOf.longValue()); BigDecimal fractional = valueOf.subtract(integerPart); String fraction = fractional.toPlainString(); int indexOfDot = fraction.indexOf('.') + 1; String sign = fraction.startsWith("-") ? "-" : ""; fraction = fraction.length() > indexOfDot ? fraction.substring(indexOfDot) : fraction; if (fraction.equals("0")) { ... |
String | formatCause(final String message, final Throwable cause, final Object... args) format Cause if (cause == null) { return format(message, args); } else { return formatThrowable(format(message, args), cause); |
String | formatDuring(long mss, String pattern) format During long days = mss / (1000 * 60 * 60 * 24); long hours = (mss % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60); long minutes = (mss % (1000 * 60 * 60)) / (1000 * 60); long seconds = (mss % (1000 * 60)) / 1000; return MessageFormat.format(pattern, days, hours, minutes, seconds); |
String | formatError(Map.Entry format Error int count = entry.getValue(); if (count > 1) { return MessageFormat.format(errorPlural, count, entry.getKey()); } else { return MessageFormat.format(errorSingular, entry.getKey()); |
String | formatMessage(final String pattern, final Object... params) format Message try { return MessageFormat.format(pattern, params); } catch (Exception e) { return '!' + pattern + '!'; |