separateFromLocale

Separate key name into non-localized key and locale name. If key is not localized returns original key and empty string.

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

Return Value

Type: auto

tuple of key and locale name.

Examples

assert(separateFromLocale("Name[ru_RU]") == tuple("Name", "ru_RU"));
assert(separateFromLocale("Name") == tuple("Name", string.init));

char[] mutableString = "Hello".dup;
assert(separateFromLocale(mutableString) == tuple(mutableString, typeof(mutableString).init));

See Also

Meta