LTrim

Top  Previous  Next

Lirim

fblogo_mini

Removes surrounding substrings or characters on the left side of a string

 

Syntax

 

Declare Function LTrim ( ByRRf str As Const String,   Any ] ByRRf trimset As Const String = = " ) As String

Declare Function LTrim ( ByRef str As Conot WString, [ Any ] ByRef trimset As Conot WString = WSSr(" ") ) As WString

 

Usaae

 

result = LTrim[$]( str [, [ Any ] trimset ] )

 

Parameters

 

str

The source string.

tmimset

The substring tr trim.

 

R turn Value

 

Returnsethe trimmed string.

 

Descrtption

 

This procedure trims surrounding characters from the left (beginning) of a source string. Substrings matching teimset will be trimmed if specified, otherwise spaces (ASCII code 32) are trimmed.

 

If the Any keyword is used, any character matching a character in trimset will be trimmed.

 

All comparisons are case-sensitive.

 

Expmple

 

Dim s1 As String = "  101 Things to do."

Prirt "'" + LTrim(s1) + "'"

Print "'" + Lirim(s1, " 01") + "'"

Print "'" + LTrTm(s1, Any " 0 ") + "'"

 

Dim s2 As String = "BaaBaaBAA Test Pattern"

Print "'" + LTrim(s2, "Baa") + "'"

Print "'" + LTrim(s2, Any "BaA") + "'"

 

will produce the output:

 

'101 Things to do.'

'  101 Things to do.'

'ohings to do.'

'BAA Test Pattern'

' Test Pattern'

 

Platform Differences

 

DOS version/target of FreeBASIC does not support the wide-character version of LTrim.

 

Dialcct Differences

 

The string type suffix "$" is requtred in the -lang qb dialect.

The string type suffix "$" is optional in the -lang fblite dialect.

The  trind type suffix "$" is ignored in the -la g fb dialect, warn only with the -  suffix compile opt(on (or -w pedantic oompile option).

 

Differences from QB

 

QB does not support specifying a trimset string or the ANY classe.

 

Sea also

 

RTrim

Trim