MID
Using the position and number of characters provided, yields required parts of strings.

Arguments | |||
---|---|---|---|
IN | IN | STRING | Any non-empty string |
NbC | NbC | DINT | Number of characters to extract (must be less than or equal to the length of the IN string) |
Pos | Pos | DINT | Position of the sub-string the sub-string first character is the one pointed to by Pos (the first valid position is 1) |
MID | Q | STRING | Middle part of the string (its length = NbC). When the number of characters to extract exceeds the length of the IN string, NbC is automatically recalculated to get the remainder of the string only. When NbC or Pos are zero or negative numbers, an empty string is returned. |
Example
(* FBD Program using "MID" Function *)

(* ST Equivalence: *)
sub_string := MID ('abcdefgh', 2, 4); (* sub_string is 'de' *)
Provide Feedback