RIGHT (extract right of a string)

The RIGHT instruction extracts characters from the right side of a string.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
RIGHT
RIGHT
RIGHT parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
Instruction enable.
  • TRUE: Extract specified number of characters from the right end of the 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.
RIGHT
Output
STRING
Right part of the string (length = NbC). Can be:
  • Empty string if NbC <= 0.
  • Complete string if NbC >= string length.
ENO
Output
BOOL
Enable output.
Applies to ladder diagram programs.

RIGHT examples

RIGHT function block diagram example
RIGHT function block diagram example
RIGHT ladder diagram example
RIGHT ladder diagram example
RIGHT structured text example
RIGHT 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