STRING

A variable of data type STRING can accept any string. The size specification for the storage space allocation in the declaration refers to characters and is enclosed by round or square brackets. If no size is specified, TwinCAT assumes 80 characters by default.

As a rule, TwinCAT does not limit the string length, but the string function only processes lengths between 1 and 255! If a variable is initialized with a string that is too long for the data type of the variable, TwinCAT truncates the string from the right.

STRING 1:

The storage space required for a STRING variable is always 1 byte per character + 1 additional byte, e.g. 81 bytes for a "STRING(80)" declaration.

Sample: string declaration with 35 characters

sVar : STRING(35) := 'This is a String';

See also: