DELETE (FUN)

FUNCTION DELETE : STRING(255)

Löscht eine Anzahl von Zeichen aus einem String.

DELETE (STR, LEN, POS) means: Delete LEN characters from STR, beginning with the character in the POS position.

POS = 0 or POS = 1, are both addressing the first character.

Info

The current implementation is unfortunately not correct for the case Pos=0. The implementation cannot be changed for compatibility reasons.

If Pos=0 is used, the parameter LEN is internally reduced by one!

It is generally recommended to use values in the range specified by IEC 61131-3. The smallest value for Pos is specified there as 1.

(* Example declaration *)
VarSTRING1 : STRING ;

(* Example in ST , result is 'SUSI' *)
VarSTRING1 := DELETE ('SUXYSI',2,3);
Ein-/Ausgänge:

Gültigkeitsbereich

Name

Typ

Beschreibung

Return

DELETE

STRING(255)

Nach dem Löschen verbleibender String

Eingang

STR

STRING(255)

String der verändert wird

LEN

INT

Länge des Teilstrings, der gelöscht werden soll, Anzahl von Zeichen

POS

INT

Position in STR, nach der das Löschen beginnt. Von links gezählt, mit 1 beginnend