MID

MID 1:

The function MID returns a partial string from within a string.
MID (STR, LEN, POS) means: Retrieve LEN characters from the STR string beginning with the character at position POS.

FUNCTION MID: STRING (255)

VAR_INPUT
    STR : STRING(255);
    LEN : INT;
    POS : INT;
END_VAR

Example in IL:

LD 'SUSI'
MID 2,2
ST Var1 (* Result is 'US' *) 

Example in ST:

Var1 := MID ('SUSI',2,2); 

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard