DELETE
Function Name |
DELETE |
---|---|
Description |
Removes a defined number of characters from an input string and outputs the remainder of the string. |
Arguments |
IN {STRING} The IN input is a string input. It has a specified number of characters removed by the DELETE function then its remaining characters are used as the output. L {INT} The L input defines the number of characters that will be removed from the IN input for the output string. P {INT} The P input defines the position of the character in the string where the deletion starts (1 is the first character, 2 is the second character, 3 is the 3rd character and so on). For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Output {STRING} The output is the characters remaining from the IN string (IN string - L characters starting from P). |
Example:
Function Block Diagram - DELETE:
In this example, the IN is ALARMCONDITIONS, the L is 10, the P is 6 and so the output is ALARM. 10 characters have been deleted from the 6th character (inclusive) onwards—CONDITIONS has been removed.
ST Program - DELETE:
To use a DELETE function in an ST program, you need to use this syntax:
- Output := DELETE (IN, L, P);
Where Output, IN, L, and P are defined as variables earlier in the ST program.
Alternatively, you can use the following syntax:
- Output := DELETE (IN:= 'ALARMCONDITIONS', L:= 10, P:= 6);
Where the 'ALARMCONDITIONS', 10 and 6 values are the input values (in this case, they are the same values as used in the Function Block Diagram example above).