DELETE - Deletes part of a string

Help Contents


Deletes a number of characters from a string starting at a position in the string.


Informal Syntax:

DELETE( In, L , P )

Formal Syntax:

DELETE( In:=expression, L:=expression , P:=expression )


InANY_STRINGThe target string.
LANY_INTThe number of characters to delete.
PANY_INTThe 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.

Return Value

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.


ExampleReturn 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"

Standards Compliance

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.

Further Information

String Functions

To learn about other String Functions.

Common Elements

To learn about other IEC 61131-3 Common Elements.


For the meaning of terms used in Fernhill SCADA.