MID¶
Provided by standard.lib.
Mid returns a partial string from within a string.
Input STR is type STRING, LEN and POS are type INT, the return value of the function is type STRING.
MID (STR, LEN, POS) means: Retrieve LEN characters from the STR string beginning with the character at position POS.
Example in IL
LD ‘SUSI’
MID 2,2
ST VarSTRING1 (* Result is ‘US’ *)
Example in FBD
Example in ST
VarSTRING1 := MID (‘SUSI’,2,2);
Note
String functions are not “thread safe”: When using tasks, string functions may only be used in a single task. If the same function is used in different tasks, there is a danger of overwriting.