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

Stringformat(final Date date, final String format)
Formats a Date according to the first format in the array.
if (date == null) {
    throw new IllegalArgumentException("Date is null");
final SimpleDateFormat formatter = new SimpleDateFormat(format, Locale.US);
formatter.setTimeZone(TIMEZONE_GMT);
return formatter.format(date);
Stringformat(final double num, final int prec)
format
nf.setMinimumFractionDigits(prec);
nf.setMaximumFractionDigits(prec);
nf.setGroupingUsed(false);
return nf.format(num);
Stringformat(final String bundleKey, final String messageKey, final Locale locale, final Object... arguments)
format
assert bundleKey != null;
assert messageKey != null;
assert locale != null;
MessageFormat messageFormat;
StringBuffer result;
FieldPosition pos;
messageFormat = getMessageFormat(bundleKey, messageKey, locale);
result = new StringBuffer();
...
Stringformat(int[] a)
Formats the int array a for printing purposes.
return (a == null) ? "null" : (a.length == 0) ? "" : 
        formatTo(new StringBuilder(), a, ", ").toString();
Stringformat(Locale locale, ResourceBundle bundle, String key, Object... args)
Formats a message from the specified ResourceBundle using the specified arguments.
MessageFormat formatter = new MessageFormat("");
formatter.setLocale(locale);
formatter.applyPattern(bundle.getString(key));
return formatter.format(args);
Stringformat(Locale locale, String key, Object... arguments)
format
String pattern = get(locale, key);
return MessageFormat.format(pattern, arguments);
Stringformat(Number number)
Formats the specified number to be readable to the human eye.
StringBuilder bldr = new StringBuilder();
int power = (int) Math.log10(number.doubleValue());
double value = Math.floor(number.doubleValue() / Math.pow(10, power / 3 * 3));
bldr.append(DECIMAL_FORMAT.format(value)).append(FORMAT.charAt(power / 3));
bldr.append(" (").append(NUMBER_FORMAT.format(number)).append(")");
return bldr.toString();
Stringformat(Number number, Locale locale)
format
return NumberFormat.getInstance(Locale.CANADA_FRENCH).format(number);
Objectformat(Object input, int style)
DOC Zqin Comment method "format".
try {
    if (checkInput(input)) {
        DecimalFormat format = null;
        BigDecimal zero = new BigDecimal(0);
        BigDecimal temp = new BigDecimal(input.toString());
        BigDecimal min = new BigDecimal(10E-5);
        BigDecimal max = new BigDecimal(9999 * 10E-5);
        boolean isUseScientific = false;
...
Stringformat(String bundleName, Locale locale, String key, Object arg1)
format
return format(bundleName, locale, key, new Object[] { arg1 });