Java Utililty Methods Locale Format

List of utility methods to do Locale Format

Description

The list of methods to do Locale Format are organized into topic(s).

Method

voidformatLines(String target, int maxLength, Locale currentLocale)
Format lines.
BreakIterator boundary = BreakIterator.getLineInstance(currentLocale);
boundary.setText(target);
int start = boundary.first();
int end = boundary.next();
int lineLength = 0;
while (end != BreakIterator.DONE) {
    String word = target.substring(start, end);
    lineLength = lineLength + word.length();
...
StringformatLocaleDate(final java.util.Date date)
Return a string representation of the supplied date with the current default locale.
return formatLocaleDate(date, Locale.getDefault());
StringformatLocaleTime(long time, Locale locale)
format Locale Time
if (time == -1)
    return "-";
return DateFormat.getTimeInstance(DateFormat.SHORT, locale).format(new Date(time));
StringformatMailDate(Date date)
Format the date.
if (date != null) {
    DateFormat format = SimpleDateFormat.getDateTimeInstance(SimpleDateFormat.MEDIUM,
            SimpleDateFormat.SHORT, Locale.GERMAN);
    return format.format(date);
} else {
    return "";
StringformatMessage(@Nonnull ResourceBundle bundle, @Nonnull String messageKey, @Nullable Object... args)
format Message
final String plainMessage = bundle.getString(messageKey);
final String message = new MessageFormat(plainMessage, bundle.getLocale()).format(args);
return message;
StringformatMessage(String messageKey, Locale locale)
format Message
MessageFormat mf = new MessageFormat(getMessageString(messageKey, locale));
return mf.format(new Object[0]);
StringformatMysqlDate(final Date date)
Format mysql date.
return formatDate(date, PATTERN_MYSQL);
StringformatNumber(double d, String pattern)
format Number
DecimalFormat dn = new DecimalFormat(pattern, dfs);
return dn.format(d);
StringformatNumber(long number)
Pretty print the supplied number.
return NumberFormat.getInstance(locale).format(number);
StringformatNumber(long value)
format Number
return NumberFormat.getInstance(Locale.ENGLISH).format(value);