components(fromLocaleIdentifier:)
Returns a dictionary that is the result of parsing a locale ID.
Declaration
class func components(fromLocaleIdentifier string: String) -> [String : String]Parameters
- string:
A locale ID, consisting of language, script, country, variant, and keyword/value pairs, for example,
"en_US@calendar=japanese".
Return Value
A dictionary that is the result of parsing string as a locale ID. The keys are the constant NSString constants corresponding to the locale ID components, and the values correspond to constants where available. For possible values, see NSLocale.Key.
Discussion
For example, the locale identifier "en_US@calendar=japanese" yields a dictionary with three entries:
languageCode =
encountryCode =
US