CODESYS DELETE

DELETE is a standard string function in the CODESYS Standard library. It removes a given number of characters from a string, starting at a specified position, and returns the remaining string as a STRING(255) value. It is written as DELETE(STR, LEN, POS) and is used in structured text programs.

Source checked12/12 values · 2026-10-26

Specification

2 sources
Languagestructured text
CodeDELETE
GroupString Functions
SyntaxDELETE (STR, LEN, POS)
DialectCODESYS

Parameters

NameData typeDescription
STRSTRING(255)String to be modified.
LENINTLength of the partial string to be deleted, number of characters.
POSINTPosition in STR after which the deletion starts, counted from left starting with 1.

Study notes

  • Declared as FUNCTION DELETE : STRING(255).
  • Return value is the string remaining after deletion.
  • Position POS is counted from the left, starting with 1; both POS = 0 and POS = 1 address the first character.
  • Example: VarSTRING1 := DELETE('SUXYSI',2,3); gives the result 'SUSI'.
  • The current implementation is not correct for POS = 0: LEN is internally reduced by one. This cannot be changed for compatibility reasons.
  • The library recommends using values in the range specified by IEC 61131-3, where the smallest value for POS is 1.
  • The documentation lists an InOut scope section with no parameters.
↑↓ navigate↵ openesc close