IniLikeGroup.escapedValue - multiple declarations
Function IniLikeGroup.escapedValue
Get value by key in escaped form.
final string escapedValue
(
string key
) pure nothrow @nogc @safe const;
Returns
The escaped value associated with the key, or empty string if group does not contain such item.
See Also
Function IniLikeGroup.escapedValue
Perform locale matching lookup as described in Localized values for keys.
final string escapedValue
(
string key,
string locale,
std .typecons .Flag!("nonLocaleFallback") nonLocaleFallback = cast(Flag)true
) pure nothrow @safe const;
Parameters
Name | Description |
---|---|
key | Non-localized key. |
locale | Locale in intereset. |
nonLocaleFallback | Allow fallback to non-localized version. |
Returns
The escaped localized value associated with key and locale, or the value associated with non-localized key if group does not contain localized value and nonLocaleFallback is true.
See Also
Example
auto lilf = new IniLikeFile;
lilf .addGenericGroup("Entry");
auto group = lilf .group("Entry");
assert(group .groupName == "Entry");
group .setEscapedValue("Name", "Programmer");
group .setEscapedValue("Name[ru_RU]", "Разработчик");
group .setEscapedValue("Name[ru@jargon]", "Кодер");
group .setEscapedValue("Name[ru]", "Программист");
group .setEscapedValue("Name[de_DE@dialect]", "Programmierer"); //just example
group .setEscapedValue("Name[fr_FR]", "Programmeur");
group .setEscapedValue("GenericName", "Program");
group .setEscapedValue("GenericName[ru]", "Программа");
assert(group .escapedValue("Name") == "Programmer");
assert(group .escapedValue("Name", "ru@jargon") == "Кодер");
assert(group .escapedValue("Name", "ru_RU@jargon") == "Разработчик");
assert(group .escapedValue("Name", "ru") == "Программист");
assert(group .escapedValue("Name", "ru_RU.UTF-8") == "Разработчик");
assert(group .escapedValue("Name", "nonexistent locale") == "Programmer");
assert(group .escapedValue("Name", "de_DE@dialect") == "Programmierer");
assert(group .escapedValue("Name", "fr_FR.UTF-8") == "Programmeur");
assert(group .escapedValue("GenericName", "ru_RU") == "Программа");
assert(group .escapedValue("GenericName", "fr_FR") == "Program");
assert(group .escapedValue("GenericName", "fr_FR", No .nonLocaleFallback) is null);