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
DecodeLastRune
Input
pbyData
POINTER TO BYTE
Pointer to the first byte in memory
udiSize
UDINT
Size of the memory in bytes
Output
udiLength
UDINT
Length of the rune in bytes
udiIndex
UDINT
Index of the last rune (depending to the bytes in memory)