MID
PROGRAM MID_DEMO
VAR
STRING1,STRING2: STRING;
INT1, INT2: INT;
END_VAR
STRING1:=MID(IN:=STRING2,L:=INT2,P:=INT1);
END_PROGRAM
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.
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 |
Output | Type | Description |
---|---|---|
=> | ANY_STRING | Output string |
IN: HAMBURGER
L: 3
P:1
Output: HAM