Glossary · Automation fundamentals, platforms and components
String (data type)
Also known as: STRING, WSTRING, Character string
German: String
In programming, a string is a data type that holds a sequence of characters. IEC 61131-3 defines STRING for single-byte characters and WSTRING for double-byte characters; the maximum length can be declared, and the default length is implementation-dependent.
- Automation components
In one sentence
A string holds a sequence of characters; IEC 61131-3 defines STRING (single-byte) and WSTRING (double-byte) with declarable length.
Example
The batch ID from the MES is stored in a STRING[20] variable and printed on the label together with the production date.
How it applies
- Engineering: Strings in PLCs carry batch IDs, recipe names, messages and barcode data. Declared maximum lengths truncate longer texts, and character encoding matters when exchanging with other systems.
- Integration: When strings are exchanged via fieldbus, OPC UA or registers, both sides must agree on length, encoding and termination. Non-ASCII characters, such as umlauts, often break STRING-based interfaces.
- Documentation: Interface specifications give maximum length and encoding for each string field. Translation teams need to know text length limits for HMI and message strings, because translated texts are often longer than the original.
STRING vs. WSTRING
STRING uses one byte per character and suits ASCII or a single-byte code page. WSTRING uses two bytes per character and is needed for many non-Latin scripts.