REPLACE

Provided by Standard Library.

Function of type STRING, replaces a partial string from a larger string with another string.

Inputs:

STR1 : STRING, string of which a part should be replaced by string STR2

STR2 : STRING, string which should replace a part of STR1

L : INT, length of partial string in STR1 which should be replaced, value must be greater or equal “0”

P : INT, position where STR2 should be inserted instead of the existing L characters, counted from left, starting with “1”; value must be greater “0”.

Return value: STRING, resulting string

REPLACE(STR1, STR2, L, P) means: Replace L characters from STR1 by STR2, beginning with the character in the P position.

Example in IL: ( Result is ‘SKYSI’ )\ \ \ \

../_images/963c3a0a1e8f806bc0a8640e01947982

Example in FBD:\ \ \ \

../_images/603b3eea1e8f7fbec0a8640e01947982

Example in ST:\ \ \ \

VarSTRING1 := REPLACE ('SUXYSI','K',2,2);