For STRING, the serialization buffer always stores its length in the first byte at the given
offset, followed by the CHARs in sequence. In the following example:
t[4]= 2,t[5]= 97 storesCHAR'a',t[6]= 98 storesCHAR'b'.
USING System.Serialization;
FUNCTION SerDe_Demo
VAR_TEMP
data : ARRAY[0..6] OF BYTE;
str : STRING := 'ab';
nextValueOffset : UDINT;
END_VAR
// data = [0x0, 0x0, 0x2, 0x61, 0x62, 0x0, 0x0]
// nextValueOffset = 5
nextValueOffset := Serialize(UDINT#2, str, data);
END_FUNCTION