List of utility methods to do Message Format
String | formatMessage(final String pattern, final String param1) format Message try { final Object[] args = { param1 }; return MessageFormat.format(pattern, args); } catch (Exception e) { return '!' + pattern + '!'; |
String | formatMessage(String message, Object param1) format Message return formatMessage(message, new Object[] { param1 }); |
String | formatMessage(String message, Object... args) format Message MessageFormat messageFormat = new MessageFormat(message); return messageFormat.format(args); |
String | formatResource(Object[] info, String require) format Resource require = require.replaceAll("\'", "\""); String result = MessageFormat.format(require, info); return result.replaceAll("\"", "\'"); |
String | formats(String pattern, Object... args) formats return MessageFormat.format(pattern, args);
|
String | formatString(ResourceBundle resourceBundle, String key, Object data) Returns the localized string associated with a resource key and formatted with a given string. if (resourceBundle != null) { try { String localizedStr = resourceBundle.getString(key); return MessageFormat.format(localizedStr, new Object[] { data }); } catch (MissingResourceException e) { return '[' + key + ']'; ... |
String | formatString(String format, String arg1) Convenience formatting methods. return MessageFormat.format(format, new Object[] { arg1 }); |
String | formatString(String message, Object... args) Format the given message with the provided arguments. if (args == null) return message; return MessageFormat.format(message, args); |
String | formatString(String str, String pattern) format String if (str == null) return ""; if (pattern == null || pattern.trim().equals("")) { return str; } else { Object objs[] = new Object[1]; objs[0] = str; return MessageFormat.format(pattern, objs); ... |