| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Extracts characters from the right side of a string
Right( <cString>, <nCount> ) --> cSubString
The function returns a character string containing Min( <nCount>, Len(<cString>) ) characters.
The character function Right() extracts a substring from the right side of <cString>. The returned substring contains <nCount> characters. If <nCount> is larger than Len(<cString>), the return value is a copy of <cString>.
The counterpart of Right() is Left(), which extracts a substring from the left side of a string.
| See also: | At(), HB_ATokens(), Left(), LTrim(), RAt(), RTrim(), Stuff(), SubStr() |
| Category: | Character functions |
| Source: | rtl\right.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example illustrates return values of function Right()
PROCEDURE Main
? CDoW(Date()) // result: Friday
? Right( CDoW(Date()), 3) // result: day
? Time() // result: 14:45:12
? Right( Time(), 5) // result: 45:12
? Right("xHarbour", 7) // result: Harbour
RETURN
http://www.xHarbour.com