QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The LTRIM$ function removes leading space characters from a STRING value.

Syntax

return$ = LTRIM$(text$)

Description

Example(s)

Trimming a positive string number.


value = 12345
number$ = LTRIM$(STR$(value)) 'converting number to string removes right PRINT space
PRINT "[" + number$ + "]" 


[12345]

Trimming leading spaces from text strings.


PRINT LTRIM$("some text")
PRINT LTRIM$("   some text") 


some text
some text

A TRIM$ function to trim spaces off of both ends of a string.


text$ = "        Text String           "
trimmed$ = TRIM$(text$)
PRINT CHR$(26) + trimmed$ + CHR$(27) 

FUNCTION TRIM$(text$)
TRIM$ = LTRIM$(RTRIM$(text$))
END FUNCTION 


→Text String←

See Also