LEN

LEN 1:

Returns the length of a string.

FUNCTION LEN : INT

VAR_INPUT
    STR     :STRING(255);
END_VA

Example in IL:

LD 'SUSI'

LEN

ST Var1 (* Result is 4 *)

Example in ST:

Var1 := LEN ('SUSI');

Requirements

Development environment

Target system type

PLC libraries to include

TwinCAT Version >= 2.6.0

PC or CX (x86)

Standard.Lib

TwinCAT Version >= 2.6.0

BC (165)

Standard.Lb6

TwinCAT Version >= 2.9.0

BCxx50 or BX

Standard.lbx

TwinCAT Version >= 2.10.0 Build >= 1301

CX (ARM)

Standard.lib