1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-06-29 11:40:38 +00:00
QB64-PE/internal/help/_TRIM$.txt
SteveMcNeill 33adc04fc4 Add temp folder to repo. It's necessary as well!
Just more initial setting on... nothing much to see here.
2022-04-28 13:39:56 -04:00

40 lines
1.1 KiB
Plaintext

{{DISPLAYTITLE:_TRIM$}}
The [[_TRIM$]] function removes both leading and trailing space characters from a [[STRING]] value.
{{PageSyntax}}
:{{Parameter|return$}} = [[_TRIM$]]({{Parameter|text$}})
{{PageDescription}}
* Shorthand to using [[LTRIM$]]([[RTRIM$]]("text"))
* {{Parameter|text$}} is the [[STRING]] value to trim.
* If {{Parameter|text$}} contains no leading or trailing space characters, it is returned unchanged.
* Convert fixed length [[STRING]] values by using a different {{parameter|return$}} variable.
{{PageExamples}}
''Example: Demonstrating how _TRIM$(text$) can replace LTRIM$(RTRIM$(text$)):
{{CodeStart}}
text$ = {{Cl|SPACE$}}(10) + "some text" + {{Cl|SPACE$}}(10)
{{Cl|PRINT}} "[" + text$ + "]" '' ''
{{Cl|PRINT}} "[" + {{Cl|RTRIM$}}(text$) + "]" '' ''
{{Cl|PRINT}} "[" + {{Cl|LTRIM$}}(text$) + "]" '' ''
{{Cl|PRINT}} "[" + {{Cl|LTRIM$}}({{Cl|RTRIM$}}(text$)) + "]" '' ''
{{Cl|PRINT}} "[" + {{Cl|_TRIM$}}(text$) + "]" '' ''
{{CodeEnd}}
{{OutputStart}}[ some text ]
[ some text]
[some text ]
[some text]
[some text]
{{OutputEnd}}
{{PageSeeAlso}}
* [[RTRIM$]], [[LTRIM$]]
{{PageNavigation}}
<