DecodeLastRune (FUN)ΒΆ
FUNCTION DecodeLastRune : RUNE
Unpacks the last UTF-8 encoding in pbyData and returns the rune and
its position (udiIndex) and length (udiLength) in bytes.
If pbyData is empty it returns (c_diRuneError, udiLength=0).
Otherwise, if the encoding is invalid, it returns (c_diRuneError, udiLength=1`).
Both are impossible results for correct, non-empty UTF-8.
An encoding is invalid if it is incorrect UTF-8, encodes a rune that is out of range, or is not the shortest possible UTF-8 encoding for the value. No other validation is performed.
- InOut:
Scope
Name
Type
Comment
Return
DecodeLastRuneInput
pbyDataPOINTER TO BYTE
Pointer to the first byte in memory
udiSizeUDINTSize of the memory in bytes
Output
udiLengthUDINTLength of the rune in bytes
udiIndexUDINTIndex of the last rune (depending to the bytes in memory)