Replace text REPLACE
Swaps Count characters at Position for B.
Text'FILL OFF'
From6
Count3
With'ON '
Dest'FILL ON '
| Tag | After two scans |
|---|---|
| Msg | 'FILL OFF' |
| MsgOut | 'FILL ON ' |
| NewState | 'ON ' |
| StateLen | 3 |
| StatePos | 6 |
How it's used
Use REPLACE to change part of a message.
Text'FILL OFF'
From
Count
With'ON '
Dest'FILL ON '
| Tag | Value |
|---|---|
| Msg | 'FILL OFF' |
| NewState | 'ON ' |
| MsgOut | 'FILL ON ' |
MsgOut reads FILL ON.
Operands
| Operand | Data type | Read or write |
|---|---|---|
| A | STRING or a number | Reads |
| B | STRING or a number | Reads |
| Count | DINT or a number | Reads |
| Position | DINT or a number | Reads |
| Dest | STRING | Writes |
Common mistakes
- Assuming replacement always fitsCheck both the selected source range and the capacity needed for the result.