Function matchTypeFromString

Get symbolic constant of match type according to the string.

MagicMatch.Type matchTypeFromString (
  const(char)[] str
) pure nothrow @nogc @safe;

Returns

MagicMatch.Type for passed string, or MagicMatch.Type.string_ if type name is unknown.

Example

assert(matchTypeFromString("string") == MagicMatch.Type.string_);
assert(matchTypeFromString("little32") == MagicMatch.Type.little32);
assert(matchTypeFromString("byte") == MagicMatch.Type.byte_);
assert(matchTypeFromString("") == MagicMatch.Type.string_);