Click or drag to resize

LTrim Function

X#
Remove leading spaces from a string.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.19
Syntax
 FUNCTION LTrim(
	Expression AS STRING,
	Flags AS LONG,
	TrimChars PARAMS STRING[]
) AS STRING
Request Example View Source

Parameters

Expression
Type: String
Specifies an expression to remove leading spaces or 0 bytes from, respectively
Flags
Type: Long
TrimChars
Type: String
Specifies one or more character strings that are trimmed from the beginning of cExpression. If cParseChar isn't included, then leading spaces or 0 bytes are removed from Expression.

Return Value

Type: String
cString with the leading spaces removed.
If cString is a NULL_STRING or all spaces, LTrim() returns a NULL_STRING.
Remarks
LTrim() is used to format strings that have leading spaces, for example, numbers that have been converted to strings using Str(). LTrim() is related to RTrim(), which removes trailing spaces, and AllTrim(), which removes both leading and trailing spaces.
The inverse of AllTrim(), LTrim(), and RTrim() are the PadC(), PadR(), and PadL() functions, which center, right-justify, and left-justify strings by padding them with fill characters.
Examples
These examples illustrate LTrim() used with several other functions:
X#
1nNumber = 18
2? Str(nNumber)                            // 18
3? SLen(Str(nNumber))                    // 10
4? LTrim(Str(nNumber))                    // 18
5? NTrim(nNumber)                        // 18
6? SLen(LTrim(Str(nNumber)))                // 2
See Also