Function parseKeyValue

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

auto auto parseKeyValue(String) (
  String s
) pure nothrow @nogc @trusted
if (isSomeString!String && is(ElementEncodingType!String : char));

Returns

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.

Example

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));