RIGHT¶
Returns the rightmost characters of a string.
Signature¶
┌─────────┐
IN ─┤ │
│ RIGHT ├─ OUT
L ─┤ │
└─────────┘
FUNCTION RIGHT : ANY_STRING
VAR_INPUT
IN : ANY_STRING;
L : ANY_INT;
END_VAR
END_FUNCTION
The return type matches the type of IN. RIGHT accepts STRING
for IN; L is INT.
Inputs
Name |
Type |
Description |
|---|---|---|
|
|
The source string. |
|
|
Number of rightmost characters to return. |
Outputs
Name |
Type |
Description |
|---|---|---|
Return value |
|
The rightmost L characters of IN. Same type as IN. |
Description¶
Returns the rightmost L characters of IN. If L is greater than or equal to the length of IN, the entire string is returned.
Example¶
result := RIGHT('Hello', 3); (* result = 'llo' *)
result := RIGHT('Hi', 10); (* result = 'Hi' *)
See Also¶
References¶
IEC 61131-3 §2.5.1.5.7