FUNCTION REPLACE : STRING(255)
Replaces a specific number of characters of a string by another string
REPLACE(STR1, STR2, L, P) means: Replace L characters from STR1 by STR2, beginning with the character in the P position.
POS = 0 or POS = 1, are both addressing the first character.
The current implementation is unfortunately not correct for the case P=0. The implementation cannot be changed for compatibility reasons.
If P=0 is used, the parameter L is internally reduced by one!
It is generally recommended to use values in the range specified by IEC 61131-3. The smallest value for P is specified there as 1.
(* Example declaration *)
VarSTRING1 : STRING ;
(* Example in ST , result is 'SKYSI' *)
VarSTRING1 := REPLACE ('SUXYSI','K',2,2);
InOut: |
|