WREPLACE

WREPLACE 1:

The function WREPLACE replaces a substring of a WSTRING with another WSTRING.
WREPLACE (STR1, STR2, L, P) means: Replace L characters from STR1 with STR2 beginning with the Pth character.

FUNCTION WREPLACE: WSTRING (255)

VAR_INPUT
    STR1 : WSTRING(255);
    STR2 : WSTRING(255);
    L    : INT;
    P    : INT;
END_VAR

Example in IL:

LD “SUXYSI“
WREPLACE “XY“,2
ST Var1 (*Result is “SKYSI“*)

Example in ST:

Var1 := WREPLACE (“SUXYSI“,“K“,2,2);

Requirements

Development environment

Target system type

PLC libraries to be linked

TwinCAT v3.0.0

PC or CX (x86)

Tc2_Standard