public final class LocaleUtil extends Object
Modifier and Type | Method and Description |
---|---|
static Locale |
createLocale(String localeString)
This method passes through to
Locale(String) unless the provided string contains
a hyphen. |
static Locale |
getLocale(String localeString)
passes through to getLocaleConstant.
|
static Locale |
getLocaleConstant(String localeConstant)
This method returns the locale constant for the given string.
|
public static Locale getLocaleConstant(String localeConstant)
Locale.US
as an example locale constant. To retrieve that locale using this method,
pass in the string value "US". If there is no locale constant for the passed in string, then
null is returnedlocaleConstant
- a string value that names a locale constant.public static Locale createLocale(String localeString)
Locale(String)
unless the provided string contains
a hyphen. If it does, then the string is split on the hyphen and the resulting strings are
passed into the multi-parameter constructors of Locale. The passed in string should not contain
more than two hyphens as the Locale constructor with the most params is three.localeString
- the locale stringCopyright © 2012–2022 The Apache Software Foundation. All rights reserved.