RIGHT

RIGHT 1:

Right returns the right, initial string for a given string. RIGHT (STR, SIZE) means: Take the first SIZE character from the right in the string STR.

FUNCTION RIGHT :STRING(255)

VAR_INPUT
    STR     :STRING(255);
    SIZE    :INT;
END_VAR

Example in IL:

LD 'SUSI'

RIGHT 3

ST Var1 (* Result is 'USI' *)

Example in ST:

Var1 := RIGHT ('SUSI',3);

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