decodeBack

fndchar 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

useReplacementDcharif invalid UTF, return replacementDchar rather than throwing
strinput string or bidirectional Range
numCodeUnitsgives 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).

fndchar 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

fndchar 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