Returns the Unicode code point at a position in a string.
Informal Syntax:
Formal Syntax:
CODE_POINT_AT( In:=expression, P:=expression )
Parameter | Type | Description |
---|---|---|
In | ANY_STRING | The input string. |
P | ANY_INT | The 1-based index of the code point to return. |
The function is overloaded and accepts either the STRING or WSTRING type for the In parameter.
The function CODE_POINT_AT returns a DINT value representing the Unicode code point value at position P.
If the In parameter is type STRING, the function will attempt to decode between 1 and 4 UTF-8 encoded bytes. If the In parameter is type WSTRING, the function will attempt to code 1 or 2 UTF-16 encoded words.
The function returns -1 if:
Example | Return Value |
---|---|
CODE_POINT_AT('Word', 1) | DINT#87 |
CODE_POINT_AT('Word', 3) | DINT#114 |
CODE_POINT_AT('Word', 4) | DINT#0 |
CODE_POINT_AT('', 0) | DINT#-1 |
CODE_POINT_AT('Word', -1) | DINT#-1 |
CODE_POINT_AT(In:="Words", P:=3) | DINT#114 |
The function CODE_POINT_AT is an extension to the IEC 61131-3 standard.
To learn about other String Functions.
To learn about string literals and the different types of encoding used.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.