DELETE

Deletes characters from a string.

Signature

    ┌─────────┐
IN ─┤         │
 L ─┤ DELETE  ├─ OUT
 P ─┤         │
    └─────────┘
FUNCTION DELETE : ANY_STRING
  VAR_INPUT
    IN : ANY_STRING;
    L  : ANY_INT;
    P  : ANY_INT;
  END_VAR
END_FUNCTION

The return type matches the type of IN. DELETE accepts STRING for IN; L and P are INT.

Inputs

Name

Type

Description

IN

ANY_STRING

The source string.

L

INT

Number of characters to delete.

P

INT

Starting position (1-based).

Outputs

Name

Type

Description

Return value

ANY_STRING

IN with L characters removed starting at position P. Same type as IN.

Description

DELETE(IN, L, P) deletes L characters from IN starting at position P. Positions are 1-based.

Example

result := DELETE('Hello World', 6, 6);   (* result = 'Hello' *)
result := DELETE('ABCDE', 2, 2);         (* result = 'ADE' *)

See Also

  • INSERT — string insertion

  • REPLACE — string replacement

  • MID — middle substring

References