GetOctectCountByCodepoint
Short summary
This function returns required octets amount to encode code point
- Return type:
BYTE
Parameters
| Name | Type | Comment | Kind |
|---|---|---|---|
| codePoint | UnicodeCodePoint | unicode codepoint value | input |
Code
Declaration
FUNCTION INTERNAL GetOctectCountByCodepoint : BYTE(0..4)
VAR_INPUT
(* unicode codepoint value *)
codePoint : UnicodeCodePoint;
END_VAR
Implementation
IF (codePoint <= 16#007F) THEN
GetOctectCountByCodepoint := 1;
ELSIF (codePoint <= 16#07FF) THEN
GetOctectCountByCodepoint := 2;
ELSIF (codePoint <= 16#FFFF) THEN
GetOctectCountByCodepoint := 3;
ELSIF (codePoint <= 16#10FFFF) THEN
GetOctectCountByCodepoint := 4;
END_IF