mirror of
https://github.com/QB64-Phoenix-Edition/QB64pe.git
synced 2024-09-19 01:34:58 +00:00
aeb9c0668b
Note: Many files were removed (not yet existing/empty pages). The parser will try to download them on demand and will auto-generate text for missing pages (eg. most _gl pages).
58 lines
1.5 KiB
Text
58 lines
1.5 KiB
Text
{{QBDLDATE:05-20-2022}}
|
|
{{QBDLTIME:23:14:25}}
|
|
The [[LTRIM$]] function removes leading space characters from a [[STRING]] value.
|
|
|
|
|
|
{{PageSyntax}}
|
|
:{{Parameter|return$}} = [[LTRIM$]]({{Parameter|text$}})
|
|
|
|
|
|
{{PageDescription}}
|
|
* {{Parameter|text$}} is the [[STRING]] value to trim.
|
|
* If {{Parameter|text$}} contains no leading space characters, it is returned unchanged.
|
|
* Convert fixed length [[STRING]] values by using a different {{parameter|return$}} variable.
|
|
* Can be used to trim the leading space of a positive numerical value converted to a string value by [[STR$]].
|
|
|
|
|
|
{{PageExamples}}
|
|
''Example 1:'' Trimming a positive string number.
|
|
{{CodeStart}}
|
|
value = 12345
|
|
number$ = {{Cl|LTRIM$}}({{Cl|STR$}}(value)) 'converting number to string removes right PRINT space
|
|
{{Cl|PRINT}} "[" + number$ + "]"
|
|
{{CodeEnd}}
|
|
{{OutputStart}}[12345]
|
|
{{OutputEnd}}
|
|
|
|
|
|
''Example 2:'' Trimming leading spaces from text strings.
|
|
{{CodeStart}}
|
|
{{Cl|PRINT}} {{Cl|LTRIM$}}("some text")
|
|
{{Cl|PRINT}} {{Cl|LTRIM$}}(" some text")
|
|
{{CodeEnd}}
|
|
{{OutputStart}}some text
|
|
some text
|
|
{{OutputEnd}}
|
|
|
|
|
|
''Example 3:'' A TRIM$ function to trim spaces off of both ends of a string.
|
|
{{codeStart}}
|
|
text$ = " Text String "
|
|
trimmed$ = TRIM$(text$)
|
|
{{Cl|PRINT}} {{Cl|CHR$}}(26) + trimmed$ + {{Cl|CHR$}}(27)
|
|
{{Cl|FUNCTION}} TRIM$(text$)
|
|
TRIM$ = {{Cl|LTRIM$}}({{Cl|RTRIM$}}(text$))
|
|
{{Cl|END FUNCTION}}
|
|
{{CodeEnd}}
|
|
{{OutputStart}}→Text String←
|
|
{{OutputEnd}}
|
|
|
|
|
|
{{PageSeeAlso}}
|
|
* [[RTRIM$]], [[STR$]]
|
|
* [[LEFT$]], [[RIGHT$]]
|
|
* [[HEX$]], [[MID$]]
|
|
|
|
|
|
{{PageNavigation}}
|
|
|