Data Type ‘STRING’¶
A variable of the STRING data type can include any character string. The amount of memory that is allocated during a declaration refers to characters and is shown in parentheses or brackets. If a size is not defined, then CODESYS allocates 80 characters by default.
As a rule, CODESYS does not limit the string length; however, the string function processes lengths from 1 to 255 only. If a variable is initialized with a string that is too long for the data type, then CODESYS truncates the string accordingly from the right.
Attention
The memory required for a STRING variable is always one byte per character plus one additional byte (for example, 81 bytes for a STRING[80] declaration).
Example of a string declaration with 35 characters:
str : STRING(35):= 'This is a String';
See also