LEFT (extract left of a sting)

The LEFT instruction extracts characters from the left side of a string.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
LEFT
LEFT
LEFT parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
Instruction enable.
  • TRUE: Calculate number of characters from left side of string.
  • FALSE: No operation.
Applies to ladder diagram programs.
IN
Input
STRING
Any non-empty string.
NbC
Input
DINT
Number of characters to be extracted. This number cannot be greater than the length of the IN string.
LEFT
Output
STRING
Left part of the IN string (its length = NbC). Can be:
  • Empty string if NbC <= 0.
  • Complete IN string if NbC >= IN string length.
ENO
Output
BOOL
Enable output.
Applies to ladder diagram programs.

LEFT examples

LEFT function block diagram example
LEFT function block diagram example
LEFT ladder diagram example
LEFT ladder diagram example
LEFT structured text example
LEFT structured text example
(* ST Equivalence: *) complete_string := RIGHT ('12345678', 4), LEFT ('12345678', 4), 5; (* complete_string is '56781234' the value issued from RIGHT call is '5678' the value issued from LEFT call is '1234'*)
Results
Results
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal