LEN

Provided by standard.lib.

Returns the length of a string. Input STR is of type STRING, the return value of the function is type INT.

Example in IL

LD ‘SUSI’

LEN

ST VarINT1 (* Result is 4 *)

Example in FBD

../_images/796944250674baff0a317f34504982cb

Example in ST

VarSTRING1 := LEN (‘SUSI’);

Note

String functions are not “thread safe”: When using tasks, string functions may only be used in a single task. If the same function is used in different tasks, there is a danger of overwriting.