xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

LTrim()

Removes leading white-space characters from a character string.

Syntax

LTrim( <cString> ) --> cTrimmedString

Arguments

<cString>
A character string which is copied without leading white-space characters.

Return

The function returns a copy of <cString> without white-spaces at the beginning of the string.

Description

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.

Info

See also:AllTrim(), IsSpace(), PadC() | PadL() | PadR(), RTrim(), Str(), SubStr()
Category: Character functions
Source:rtl\trim.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe