decodeBack
fn
dchar decodeBack(UseReplacementDchar useReplacementDchar = No.useReplacementDchar, S)(
ref S str, out size_t numCodeUnits) if (isSomeString!S)decodeBack is a variant of decode which specifically decodes the last code point. Unlike decode, decodeBack accepts any bidirectional range of code units (rather than just a string or random access range). It also takes the range by ref and pops off the elements as it decodes them. If numCodeUnits is passed in, it gets set to the number of code units which were in the code point which was decoded.
Parameters
useReplacementDchar | if invalid UTF, return replacementDchar rather than throwing |
str | input string or bidirectional Range |
numCodeUnits | gives the number of code units processed |
Returns
A decoded UTF character.
Throws
UTFException if
str.back is not the end of a valid UTF
sequence. If an exception is thrown, the str itself remains unchanged, but there is no guarantee as to the value of numCodeUnits (when passed).
fn
dchar decodeBack(UseReplacementDchar useReplacementDchar = No.useReplacementDchar, S)(
ref S str, out size_t numCodeUnits) if (!isSomeString!S && isSomeChar!(ElementType!S) && isBidirectionalRange!S
&& ((isRandomAccessRange!S && hasLength!S) || !isRandomAccessRange!S))Ditto
fn
dchar decodeBack(UseReplacementDchar useReplacementDchar = No.useReplacementDchar, S)(ref S str) if (isSomeString!S
|| (isRandomAccessRange!S && hasLength!S && isSomeChar!(ElementType!S))
|| (!isRandomAccessRange!S && isBidirectionalRange!S && isSomeChar!(ElementType!S)))Ditto