Deletes a number of characters from a string starting at a position in the string.
Informal Syntax:
Formal Syntax:
DELETE( In:=expression, L:=expression , P:=expression )
Parameter | Type | Description |
---|---|---|
In | ANY_STRING | The target string. |
L | ANY_INT | The number of characters to delete. |
P | ANY_INT | The delete position (1-based). |
The function is overloaded and accepts either the STRING or WSTRING type for the In parameter.
Position P is 1-based, where 1 represents the first character, 2 represents the second character, and so on. If position P is less than 1, it is rounded up to 1 (the first character in the string). If position P is greater than the length of the string, no characters are deleted. If length L is zero or negative, no characters are deleted from the string.
The return value is the result of deleting L characters at position P from the string In.
The type of the return value is the same as the type of the In parameter.
Example | Return Value |
---|---|
DELETE('Inform', 2, 1 ) | STRING#'form' |
DELETE('Inform', 2, 0 ) | STRING#'form' |
DELETE("Encoded", 2, 3 ) | WSTRING#"Ended" |
DELETE("Inform", 0, 2 ) | WSTRING#"Inform" |
IEC 61131-3 Second Edition: Table 29.7.
IEC 61131-3 Third Edition: Table 34.7.
Note: The function allows negative values for the L and P parameters. The IEC 61131-3 standard states this should be an error.
Note: The function allows the L and P parameters to be a location outside the input string. The IEC 61131-3 standard states this should be an error.
To learn about other String Functions.
To learn about other IEC 61131-3 Common Elements.
For the meaning of terms used in Fernhill SCADA.