DELETE
PROGRAM DELETE_DEMO VAR IN1,OUT1: STRING; L1, P1: INT; END_VAR OUT1:=DELETE(IN1:=IN1,L:=L1,P:=P1); END_PROGRAM
The DELETE function removes part of the input string. For correct functionality, it is necessary that the length of the deleted part is greater than zero. The starting position “p” must be greater than 0 and less than the total number of characters in the string. If the deleted part is out of the input string, it is a input parameter error. If the “l” and “p” values are entered falsely, there is an exception and the PLC stops. If stop on exception is disabled, the function output gives the last correct value.
Input | Type | Description |
---|---|---|
IN | ANY_STRING | Input string |
L | ANY_INT | Length of the deleted part |
P | ANY_INT | Position where the deleted part starts, if at the first character, p=1 |
Output | Type | Description |
---|---|---|
⇒ | ANY_STRING | Output string |