RIGHT Function
Returns the specified number of characters from the end of a string.
This function is provided for compatibility with other MultiValue systems.
Syntax
RIGHT(string, charCount)
Syntax Elements
string A DataBasic expression that evaluates to a string.
charCount A DataBasic expression that evaluates to the number of characters to extract. Only the integer part is used.
Return Value
A string containing the specified number of characters from the end of the string.
Operation
The RIGHT function is equivalent to the following substring extraction operation:
string[-charCount, charCount]
If charCount is negative, the result is the substring starting at charCount and ending charCount for the end. As a result, if charCount is greater than half the length of string, an empty string is returned.
See Also
LEFT function, Substring Extraction.
Examples
S = "123456789" C = 7 R = RIGHT(S, C)
Sets R to "3456789".
S = "123456789" C = -3 R = RIGHT(S, C)
Sets R to "34567".
S = "123456789" C = 12 R = RIGHT(S, C)
Because C is greater than the length of the string, sets R to an empty string.