encodeCharRef

Returns a range of $(K_CHAR) containing the character reference corresponding to the given character.

encodeCharRef
(
dchar c
)

Parameters

c
Type: dchar

The character to encode.

Examples

1 import std.algorithm.comparison : equal;
2 
3 assert(equal(encodeCharRef(' '), " "));
4 assert(equal(encodeCharRef('A'), "A"));
5 assert(equal(encodeCharRef('\u2424'), "␤"));
6 
7 auto range = encodeCharRef('*');
8 assert(parseCharRef(range) == '*');

See Also

Meta