isValidKey

Test whether the string is valid key in terms of Desktop File Specification. Not actually used in inilike.file.IniLikeFile, but can be used in derivatives. Only the characters A-Za-z0-9- may be used in key names. See Basic format of the file Note: this function automatically separate key from locale. It does not check validity of the locale itself.

@nogc @safe pure nothrow
bool
isValidKey
(
String
)
(
String key
)
if (
isSomeString!String &&
is(ElementEncodingType!String : char)
)

Examples

assert(isValidKey("Generic-Name"));
assert(isValidKey("Generic-Name[ru_RU]"));
assert(!isValidKey("Name$"));
assert(!isValidKey(""));
assert(!isValidKey("[ru_RU]"));

Meta