parseKeyValue

Parse entry of kind Key=Value into pair of Key and Value.

@nogc @trusted pure nothrow
parseKeyValue
(
String
)
(
String s
)
if (
is(String : const(char)[])
)

Return Value

Type: auto

tuple of key and value strings or tuple of empty strings if it's is not a key-value entry. Note: this function does not check whether parsed key is valid key.

Examples

assert(parseKeyValue("Key=Value") == tuple("Key", "Value"));
assert(parseKeyValue("Key=") == tuple("Key", string.init));
assert(parseKeyValue("=Value") == tuple(string.init, string.init));
assert(parseKeyValue("NotKeyValue") == tuple(string.init, string.init));

assert(parseKeyValue("Key=Value".dup) == tuple("Key".dup, "Value".dup));

See Also

isValidKey

Meta