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