String manipulation instructions Chapter 22
Rockwell Automation Publication 2080-RM001D-EN-E - February 2015 613
REPLACE replaces parts of a string with new sets of characters.
Arguments
Parameter Parameter Type Data Type Description
EN Input BOOL Function enable.
When EN = TRUE, replace parts of strings with new characters.
When EN = FALSE, no operation.
IN Input STRING Any string.
Str Input STRING String to be inserted (to replace NbC chars).
NbC Input DINT Number of characters to be deleted.
Pos Input DINT Position of the first modified character
(first valid position is 1).
REPLACE Output STRING Modified string. The NbC characters are deleted at position Pos, then
the substring Str is inserted at this position. Can be:
• empty string if Pos <= 0
• strings concatenation (IN+Str) if Pos is greater than the length of
the IN string
• initial string IN if NbC <= 0
ENO Output BOOL Enable out.