RIGHT
Function Name |
RIGHT |
---|---|
Description |
Outputs a specific number of characters taken from a string input. The characters are taken from the right-hand side of the input string (ending with the last character). |
Arguments |
IN {STRING} The IN input is a string input. The RIGHT function uses characters from the IN input for its output. L {INT} Defines the number of characters in the IN input that are used for the output. The output ends with the last character of the IN input and starts the L number of characters prior to the end. For more information on the data types for the inputs and outputs, see Data Type Hierarchy. |
Returns |
Output {STRING} The output is a string that is the L number of characters from the IN string, starting from the right. |
Example:
Function Block Diagram - RIGHT:
In this example, the IN input is 'PIPELINE STRUCTURE FAILURE' and the L input is 17. This means that the RIGHT function will return 17 characters from the IN input, starting with the right-most character (the last character). So, as the IN input is 'PIPELINE STRUCTURE FAILURE', the RIGHT function outputs 'STRUCTURE FAILURE' (the last 17 characters from the IN string).
ST Program - RIGHT:
To use a RIGHT function in an ST program, you need to use this syntax:
- Output := RIGHT ('IN', L);
Where Output, IN and L are defined as variables earlier in the ST program.
Alternatively, you can use the following syntax:
- Output := RIGHT (IN:= 'PIPELINE STRUCTURE FAILURE', L:= 17);
Where the 'PIPELINE STRUCTURE FAILURE' and 17 values are the input values (in this case, they are the same values as used in the Function Block Diagram example above).