REPLACE

Replaces a part of a message string by a new set of characters.
lrsf_re1_cam5.png
Arguments
IN
IN
MESSAGE
Any string
Str
Str
MESSAGE
String to be inserted (to replace NbC chars)
NbC
NbC
DINT
Number of characters to be deleted
Pos
Pos
DINT
Position of the first modified character
(first valid position is 1)
REPLACE
Q
MESSAGE
Modified string:
- NbC characters are deleted at position Pos
- then substring Str is inserted at this position
returns empty string if Pos <= 0
returns strings concatenation (IN+Str) if Pos is greater than the length of the IN string
returns initial string IN if NbC <= 0
Example
(* FBD program using "REPLACE" function *)
lrsf_re2_cam5
(* ST Equivalence: *)
MyName := REPLACE ('Mr X JONES, 'Frank', 1, 4); (* MyName is 'Mr Frank JONES' *)
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal