Locale class Methods in Java Part - II

java.util.Locale

A Locale object represents a specific geographical, political, or cultural region. An operation that requires a Locale to perform its task is called locale-sensitive and uses the Locale to tailor information for the user.

Some methods of Locale Class


getExtension(char key)It returns the extension (or private use) value associated with the specified key, or null if there is no extension associated with the key.


getExtensionKeys()It returns the set of extension keys associated with this locale, or the empty set if it has no extensions. The returned set is unmodifiable. The keys will all be lower-case.


getISO3Country()It returns a three-letter abbreviation for this locale's country. If the country matches an ISO 3166-1 alpha-2 code, the corresponding ISO 3166-1 alpha-3 uppercase code is returned.


getISO3Language()It returns a three-letter abbreviation of this locale's language. If the language matches an ISO 639-1 two-letter code, the corresponding ISO 639-2/T  three-letter lowercase code is returned.


Locale.getISOCountries(): It returns a list of all 2-letter country codes defined in ISO 3166.


Locale.getISOCountries(IsoCountryCode type): It returns a Set of ISO3166 country codes for the specified type.


Locale.getISOLanguages()It returns a list of all 2-letter language codes defined in ISO 639.


getLanguage()It returns the language code of this Locale.


getScript()It returns the script for this locale, which should either be the empty string or an ISO 15924 4-letter script code. The first letter is uppercase and the rest are lowercase.


getVariant()It returns the variant code for this locale.


hasExtensions()It returns true if this Locale has any extensions.


hashCode(): It returns the hashcode value.


stripExtensions()It return a copy of this Locale with no extensions. 


toLanguageTag(): It returns a well-formed IETF BCP 47 language tag representing this locale.


toString()It returns a string representation of this Locale object, consisting of language, country, variant, script, and extension.


getUnicodeLocaleType()It returns the Unicode locale type associated with the specified Unicode locale key for this locale. 


Some more Methods of Locale class


No comments:

Post a Comment