Function isValidKey

Test whether the string is valid key, i.e. does not need escaping, is not a comment and not empty string.

bool isValidKey (
  scope const(char)[] key
) pure nothrow @nogc @safe;

Example

assert(isValidKey("Valid key"));
assert(!isValidKey(""));
assert(!isValidKey("    "));
assert(!isValidKey("Sneaky\nKey"));
assert(!isValidKey("# Sneaky key"));
assert(!isValidKey("Sneaky=key"));