LEN (FUN) ¶ FUNCTION LEN : UDINT Returns the number of bytes of a string See function COUNT for calculating the number of runes InOut: Scope Name Type Comment Return LEN UDINT Input itfString IString String to be analyzed Output eErrorID ERROR
MID (FUN) ¶ FUNCTION MID : IString Returns a specific number of runes of a string, starting from a specific position Returns 0 in case of eErrorID <> ERROR.NO_ERROR See IStringRepresentation ☛ ToIString(itfResource, liStart, liStart + TO_LINT(udiCount-1)) InOut: Scope Name Type Comment Return MID IString Input itfString IString String to be analyzed udiCount UDINT Number of runes, counted from the left udiStart UDINT Start position for the partial string itfResource IString The resource that this function is working on. It will contain the result after the function call and will also be returned by this function so it can be used in nested calls. Output eErrorID ERROR
REPLACE (FUN) ¶ FUNCTION REPLACE : IString Replaces a specific number of characters of a string by another string Replace udiCount characters from itfString by itfPartial , beginning with the character in the udiStart position. InOut: Scope Name Type Comment Return REPLACE IString Input itfString IString String to be modfied itfPartial IString String which replaces a part of itfString udiCount UDINT Number of runes to be replaced, counting from left udiStart UDINT Start index of the runes to be replaced. First rune is index 0 itfResource IString The resource that this function is working on. It will contain the result after the function call and will also be returned by this function so it can be used in nested calls. Output eErrorID ERROR
utf16 ¶ Aliases Constants (GVL) RUNE (Alias) Functions DecodeRune (Function) DecodeSurrogate (Function) EncodeRune (Function) EncodeSurrogate (Function) IsSurrogate (Function)
Aliases ¶ Constants (GVL) RUNE (Alias)
Constants (GVL) ¶ InOut: Scope Name Type Initial Comment Constant c_diRuneError RUNE DINT#16#FFFD The “error” Rune or “Unicode replacement character” c_diMaxRune DINT DINT#16#10FFFF
RUNE (ALIAS) ¶ TYPE RUNE : UTF8.|dRUNE| The term rune appears in the libraries and source code, and means exactly the same as “unicode code point”, with one interesting addition. This library defines the word rune as an alias for the type DINT , so programs can be clear when an integer value represents a code point. Moreover, what you might think of as a character constant is called a rune constant. The type and value of the expression WSTRING#"⌘" is a rune with the integer value DINT#16#2318 .
Functions ¶ DecodeRune (Function) DecodeSurrogate (Function) EncodeRune (Function) EncodeSurrogate (Function) IsSurrogate (Function)
DecodeRune (FUN) ¶ FUNCTION DecodeRune : RUNE Unpacks the first UTF-16 encoding in pbyData and returns the rune and the length of the encoding in bytes. InOut: Scope Name Type Initial Return DecodeRune RUNE Input pbyData POINTER TO BYTE udiSize UDINT xHostByteOrder BOOL TRUE Output udiLength UDINT
DecodeSurrogate (FUN) ¶ FUNCTION DecodeSurrogate : Rune Returns the UTF-16 decoding of a surrogate pair. If the pair is not a valid UTF-16 surrogate pair, DecodeSurrogate returns the Unicode replacement code point U+FFFD ( c_diRuneError ). InOut: Scope Name Type Return DecodeSurrogate Rune Input diRune1 Rune diRune2 Rune