@Immutable public final class LocaleFormatter extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
getFormatted(BigDecimal aValue,
int nFractionDigits,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormatted(BigDecimal aValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormatted(BigInteger aValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormatted(double dValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormatted(int nValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormatted(long nValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static String |
getFormattedPercent(double dValue,
int nFractionDigits,
Locale aDisplayLocale)
Format the given value as percentage.
|
static String |
getFormattedPercent(double dValue,
Locale aDisplayLocale)
Format the given value as percentage.
|
static String |
getFormattedWithAllFractionDigits(BigDecimal aValue,
Locale aDisplayLocale)
Format the passed value according to the rules specified by the given
locale.
|
static Number |
parse(String sStr,
Locale aParseLocale) |
static Number |
parse(String sStr,
NumberFormat aNF) |
static BigDecimal |
parseBigDecimal(String sStr,
DecimalFormat aNF) |
static BigDecimal |
parseBigDecimal(String sStr,
Locale aParseLocale,
BigDecimal aDefault) |
static BigDecimal |
parseBigDecimal(String sStr,
NumberFormat aNF,
BigDecimal aDefault) |
static double |
parseDouble(String sStr,
Locale aParseLocale,
double dDefault) |
static double |
parseDouble(String sStr,
NumberFormat aNF,
double dDefault) |
static float |
parseFloat(String sStr,
Locale aParseLocale,
float fDefault) |
static float |
parseFloat(String sStr,
NumberFormat aNF,
float fDefault) |
static int |
parseInt(String sStr,
Locale aParseLocale,
int nDefault) |
static int |
parseInt(String sStr,
NumberFormat aNF,
int nDefault) |
static long |
parseLong(String sStr,
Locale aParseLocale,
long nDefault) |
static long |
parseLong(String sStr,
NumberFormat aNF,
long nDefault) |
@Nonnull public static String getFormatted(double dValue, @Nonnull Locale aDisplayLocale)
Double.toString(double) that are displayed to
the user should instead use this method.dValue - The value to be formatted.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormatted(int nValue, @Nonnull Locale aDisplayLocale)
Integer.toString(int) that are displayed to
the user should instead use this method.nValue - The value to be formatted.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormatted(long nValue, @Nonnull Locale aDisplayLocale)
Long.toString(long) that are displayed to the
user should instead use this method.nValue - The value to be formatted.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormatted(@Nonnull BigInteger aValue, @Nonnull Locale aDisplayLocale)
BigInteger.toString() that are displayed to
the user should instead use this method.aValue - The value to be formatted. May not be null.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormatted(@Nonnull BigDecimal aValue, @Nonnull Locale aDisplayLocale)
BigDecimal.toString() that are displayed to
the user should instead use this method. By default a maximum of 3 fraction
digits are shown.aValue - The value to be formatted. May not be null.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormatted(@Nonnull BigDecimal aValue, @Nonnegative int nFractionDigits, @Nonnull Locale aDisplayLocale)
aValue - The value to be formatted. May not be null.nFractionDigits - The number of fractional digits to use. Must be >= 0.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormattedWithAllFractionDigits(@Nonnull BigDecimal aValue, @Nonnull Locale aDisplayLocale)
aValue - The value to be formatted. May not be null.aDisplayLocale - The locale to be used. May not be null.@Nonnull public static String getFormattedPercent(double dValue, @Nonnull Locale aDisplayLocale)
dValue - The value to be used. E.g. "0.125" will result in something like
"12.5%"aDisplayLocale - The locale to use.null formatted string.@Nonnull public static String getFormattedPercent(double dValue, @Nonnegative int nFractionDigits, @Nonnull Locale aDisplayLocale)
dValue - The value to be used. E.g. "0.125" will result in something like
"12.5%"nFractionDigits - The number of fractional digits to use. Must be >= 0.aDisplayLocale - The locale to use.null formatted string.public static float parseFloat(@Nullable String sStr, @Nonnull Locale aParseLocale, float fDefault)
public static float parseFloat(@Nullable String sStr, @Nonnull NumberFormat aNF, float fDefault)
public static double parseDouble(@Nullable String sStr, @Nonnull Locale aParseLocale, double dDefault)
public static double parseDouble(@Nullable String sStr, @Nonnull NumberFormat aNF, double dDefault)
public static int parseInt(@Nullable String sStr, @Nonnull Locale aParseLocale, int nDefault)
public static int parseInt(@Nullable String sStr, @Nonnull NumberFormat aNF, int nDefault)
public static long parseLong(@Nullable String sStr, @Nonnull Locale aParseLocale, long nDefault)
public static long parseLong(@Nullable String sStr, @Nonnull NumberFormat aNF, long nDefault)
@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnull DecimalFormat aNF)
@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnull Locale aParseLocale, @Nullable BigDecimal aDefault)
@Nullable public static BigDecimal parseBigDecimal(@Nullable String sStr, @Nonnull NumberFormat aNF, @Nullable BigDecimal aDefault)
Copyright © 2006–2014 phloc systems. All rights reserved.