Serializing STRING - Manual - SIMATIC AX - System.Serialization - System.Serialization,

System.Serialization library

Portfolio
SIMATIC AX
Product
SIMATIC AX
Software version
10.3.25
Edition
01/2026
Language
English (original)
Package Name
@ax/system-serde

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 stores CHAR 'a',
  • t[6] = 98 stores CHAR '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