parseUUID

fnUUID parseUUID(T)(T uuidString) if (isSomeString!T)

This is a less strict parser compared to the parser used in the UUID constructor. It enforces the following rules:

  • hex numbers are always two hexdigits([0-9a-fA-F])
  • there must be exactly 16 such pairs in the input, not less, not more
  • there can be exactly one dash between two hex-pairs, but not more
  • there can be multiple characters enclosing the 16 hex pairs,

    as long as these characters do not contain [0-9a-fA-F]

Note

Like most parsers, it consumes its argument. This means:

------------------------- string s = "8AB3060E-2CBA-4F23-b74c-B52Db3BDFB46"; parseUUID(s); assert(s == ""); -------------------------

Throws

UUIDParsingException if the input is invalid

CTFE: This function is supported in CTFE code. Note that error messages caused by a malformed UUID parsed at compile time can be cryptic, but errors are detected and reported at compile time.

fnUUID parseUUID(Range)(ref Range uuidRange) if (isInputRange!Range && isSomeChar!(ElementType!Range))

ditto