parseLocaleName

Parse locale name into the tuple of 4 values corresponding to language, country, encoding and modifier

@nogc @trusted pure nothrow
parseLocaleName
(
String
)
(
String locale
)
if (
isSomeString!String &&
is(ElementEncodingType!String : char)
)

Return Value

Type: auto

Tuple!(string, "lang", string, "country", string, "encoding", string, "modifier")

Examples

assert(parseLocaleName("ru_RU.UTF-8@mod") == tuple("ru", "RU", "UTF-8", "mod"));
assert(parseLocaleName("ru@mod") == tuple("ru", string.init, string.init, "mod"));
assert(parseLocaleName("ru_RU") == tuple("ru", "RU", string.init, string.init));

assert(parseLocaleName("ru_RU.UTF-8@mod".dup) == tuple("ru".dup, "RU".dup, "UTF-8".dup, "mod".dup));

See Also

Meta