{{fbdoc item="title" value="LTRIM"}}---- Removes surrounding substrings or characters on the left side of a string {{fbdoc item="syntax"}}## [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Ltrim** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]], [ **Any** ] [[KeyPgByref|byref]] //trimset// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgString|string]] = " " ) [[KeyPgAs|as]] [[KeyPgString|string]] [[KeyPgDeclare|declare]] [[KeyPgFunction|function]] **Ltrim** ( [[KeyPgByref|byref]] //str// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]], [ **Any** ] [[KeyPgByref|byref]] //trimset// [[KeyPgAs|as]] [[KeyPgConstQualifier|const]] [[KeyPgWstring|wstring]] = [[KeyPgWstr|Wstr]](" ") ) [[KeyPgAs|as]] [[KeyPgWstring|wstring]] ## {{fbdoc item="usage"}}## //result// = **Ltrim**[$]( //str// [, [ **Any** ] //trimset// ] ) ## {{fbdoc item="param"}} ##//str//## The source string. ##//trimset//## The substring to trim. {{fbdoc item="ret"}} Returns the trimmed string. {{fbdoc item="desc"}} This procedure trims surrounding characters from the left (beginning) of a source string: - Substrings matching ##//trimset//## will be trimmed if specified, otherwise spaces ([[CptAscii|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. {{fbdoc item="ex"}} {{fbdoc item="filename" value="examples/manual/strings/ltrim.bas"}}%%(freebasic) dim s1 as string = " 101 Things to do." print "'" + ltrim(s1) + "'" print "'" + ltrim(s1, " 01") + "'" print "'" + ltrim(s1, any " 01") + "'" 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.' 'Things to do.' 'BAA Test Pattern' ' Test Pattern' %% {{fbdoc item="target"}} - DOS version/target of ""FreeBASIC"" does not support the wide-character version of ##**LTrim**##. {{fbdoc item="lang"}} - The string type suffix "$" is required in the //[[CompilerOptlang|-lang qb]]// dialect. - The string type suffix "$" is optional in the //[[CompilerOptlang|-lang fblite]]// dialect. - The string type suffix "$" is ignored in the //[[CompilerOptlang|-lang fb]]// dialect, warn only with the //[[CompilerOptw|-w suffix]]// compile option (or //[[CompilerOptw|-w pedantic]]// compile option). {{fbdoc item="diff"}} - QB does not support specifying a ##//trimset//## string or the ##ANY## clause. {{fbdoc item="see"}} - ##[[KeyPgRtrim|Rtrim]]## - ##[[KeyPgTrim|Trim]]## {{fbdoc item="back" value="CatPgString|String Functions"}}