A range of characters.
The character represented by the character reference that was parsed from the front of the given range or null if the range did not start with a valid, XML, character reference.
import std.range.primitives : empty; { auto range = "0 hello world"; assert(parseCharRef(range) == '0'); assert(range == " hello world"); } { auto range = "0 hello world"; assert(parseCharRef(range) == '0'); assert(range == " hello world"); } { auto range = "ディラン"; assert(parseCharRef(range) == 'デ'); assert(range == "ィラン"); assert(parseCharRef(range) == 'ィ'); assert(range == "ラン"); assert(parseCharRef(range) == 'ラ'); assert(range == "ン"); assert(parseCharRef(range) == 'ン'); assert(range.empty); } { auto range = "&#x;foo"; assert(parseCharRef(range).isNull); assert(range == "&#x;foo"); } { auto range = "foobar"; assert(parseCharRef(range).isNull); assert(range == "foobar"); } { auto range = " &x48;"; assert(parseCharRef(range).isNull); assert(range == " &x48;"); }
If the given range starts with a valid, XML, character reference, it is removed from the range, and the corresponding character is returned.
If the range does not start with a valid, XML, character reference, then the return value is null, and the range is unchanged.