parseMimeTypeName

Parse MIME type name into pair of media and subtype strings.

@nogc @trusted pure nothrow
parseMimeTypeName
(
String
)
(
scope return String name
)
if (
isSomeString!String &&
is(ElementEncodingType!String : char)
)

Return Value

Type: auto

Tuple of media and subtype strings or pair of empty strings if could not parse name.

Examples

auto t = parseMimeTypeName("text/plain");
assert(t.media == "text" && t.subtype == "plain");

t = parseMimeTypeName("not mime type");
assert(t.media == string.init && t.subtype == string.init);

Meta