Table of Contents

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

InputType Description
IN ANY_STRINGInput string
L ANY_INT Output string length
P ANY_INT Position of the start of the output string within the input string

Outputs

OutputType Description
ANY_STRINGOutput string

Application example


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