RIGHT() Return a substring beginning with the rightmost character ------------------------------------------------------------------------------ Syntax RIGHT(<cString>, <nCount>) --> cSubString Arguments <cString> is the character string from which to extract characters. <nCount> is the number of characters to extract. Returns RIGHT() returns the rightmost <nCount> characters of <cString>. If <nCount> is zero, RIGHT() returns a null string (""). If <nCount> is negative or larger than the length of the character string, RIGHT() returns <cString>. The maximum string size is 65,535 (64K) bytes. Description RIGHT() is a character function that extracts a substring beginning with the rightmost character in <cString>. It is the same as the character expression, SUBSTR(<cString>, <nCount>). For example, RIGHT("ABC", 1) is the same as SUBSTR("ABC", -1). RIGHT() is related to LEFT(), which extracts a substring beginning with the leftmost character in <cString>. The RIGHT(), LEFT(), and SUBSTR() functions are often used with both the AT() and RAT() functions to locate either the first and/or the last position of a substring before extracting it. Examples . This example shows the relationship between RIGHT() and SUBSTR(): ? RIGHT("ABCDEF", 3) // Result: DEF ? SUBSTR("ABCDEF", -3) // Result: DEF . This example extracts a substring from the end of another string up to the last occurrence of a comma: LOCAL cName := "James,William" ? RIGHT(cName,; LEN(cName) - RAT(",", cName) - 1) // Result: William Files Library is EXTEND.LIB.
See Also: RTRIM() STUFF() SUBSTR()