2017-10-10 14:55:21 +00:00
|
|
|
The [[LTRIM$]] function removes leading space characters from a [[STRING]] value.
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageSyntax}}
|
2017-10-10 14:55:21 +00:00
|
|
|
:{{Parameter|return$}} = [[LTRIM$]]({{Parameter|text$}})
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
|
|
|
{{PageDescription}}
|
2017-10-10 14:55:21 +00:00
|
|
|
* {{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$]].
|
2015-08-02 12:12:44 +00:00
|
|
|
|
|
|
|
|
2017-10-10 14:55:21 +00:00
|
|
|
{{PageExamples}}
|
2015-08-02 12:12:44 +00:00
|
|
|
''Example 1:'' Trimming a positive string number.
|
|
|
|
{{CodeStart}}
|
|
|
|
value = 12345
|
|
|
|
number$ = {{Cl|LTRIM$}}({{Cl|STR$}}(value)) 'converting number to string removes right PRINT space
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} "[" + number$ + "]" '' ''
|
2015-08-02 12:12:44 +00:00
|
|
|
{{CodeEnd}}
|
|
|
|
{{OutputStart}}[12345]
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
|
|
|
|
|
|
|
''Example 2:'' Trimming leading spaces from text strings.
|
|
|
|
{{CodeStart}} '' ''
|
2019-04-15 01:15:33 +00:00
|
|
|
{{Cl|PRINT}} {{Cl|LTRIM$}}("some text")
|
|
|
|
{{Cl|PRINT}} {{Cl|LTRIM$}}(" some text") '' ''
|
2015-08-02 12:12:44 +00:00
|
|
|
{{CodeEnd}}
|
|
|
|
{{OutputStart}}some text
|
|
|
|
some text
|
|
|
|
{{OutputEnd}}
|
|
|
|
|
|
|
|
|
|
|
|
''Example 3:'' A TRIM$ function to trim spaces off of both ends of a string.
|
|
|
|
{{codeStart}} '' ''
|
2019-04-15 01:15:33 +00:00
|
|
|
text$ = " Text String "
|
2015-08-02 12:12:44 +00:00
|
|
|
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$]]
|
|
|
|
|
|
|
|
|
2019-04-15 01:15:33 +00:00
|
|
|
{{PageNavigation}}
|