| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Removes leading white-space characters from a character string.
LTrim( <cString> ) --> cTrimmedString
The function returns a copy of <cString> without white-spaces at the beginning of the string.
LTrim() is used for formatting character strings whose first characters consist of white-space characters (Chr(9),Chr(10),Chr(13),(Chr(32)). The function creates a copy of <cString> but ignores white spaces at the beginning of the input string.
| See also: | AllTrim(), IsSpace(), PadC() | PadL() | PadR(), RTrim(), Str(), SubStr() |
| Category: | Character functions |
| Source: | rtl\trim.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows various results of function LTrim().
#define CRLF Chr(13)+Chr(10)
#define TAB Chr(9)
#define SPACE Chr(32)
PROCEDURE Main
LOCAL cStr := TAB+SPACE+CRLF+" xHarbour"
? Len( cStr ) // result: 13
? Asc( cStr ) // result: 9
? Len( LTrim( cStr ) ) // result: 8
? Asc( LTrim( cStr ) ) // result: 120
? Str(5) // result: 5
? Len( Str(5) ) // result: 10
? LTrim( Str(5) ) // result: 5
RETURN
http://www.xHarbour.com