Documentation

MID

Function name

MID

ST call

PROGRAM MID_DEMO
VAR
STRING1,STRING2: STRING;
INT1, INT2: INT;
END_VAR
STRING1:=MID(IN:=STRING2,L:=INT2,P:=INT1);
END_PROGRAM

Description

The function returns part of the string. The string length is given by the input variable L, the output string starts at the position P of the input string.

Inputs

Input Type Description
IN ANY_STRING Input string
L ANY_INT Output string length
P ANY_INT Position of the start of the output string within the input string

Outputs

Output Type Description
=> ANY_STRING Output string

Application example


IN: HAMBURGER
L: 3
P:1
Output: HAM