1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-26 07:25:53 +00:00
QB64-PE/internal/help/LTRIM$.txt
SMcNeill 6e01fc8dce Altered string compare routines (<,<=,>,>=) so they don't give false results with CHR$(0).
Added new _STRCMP and _STRICMP commands for quick string comparisons.
Cleaned up QB64 to finish removing the QUI (quick user insert) code and folders.
Altered UCASE and LCASE routines to be faster in some situations for us.
2014-09-22 08:19:03 -04:00

55 lines
1.6 KiB
Plaintext

The {{KW|LTRIM$}} function removes leading space characters from a {{KW|STRING}} value.
{{PageSyntax}}
:''return$'' = {{KW|LTRIM$}}({{Parameter|value$}})
{{PageDescription}}
* {{Parameter|value$}} is the {{KW|STRING}} value to trim.
* If {{Parameter|value$}} contains no leading space characters, {{Parameter|value$}} is returned unchanged.
* Convert fixed length {{KW|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 {{KW|STR$}}.
''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}} &quot;[&quot; + number$ + &quot;]&quot; '' ''
{{CodeEnd}}
{{OutputStart}}[12345]
{{OutputEnd}}
''Example 2:'' Trimming leading spaces from text strings.
{{CodeStart}} '' ''
{{Cl|PRINT}} {{Cl|LTRIM$}}(&quot;some text&quot;)
{{Cl|PRINT}} {{Cl|LTRIM$}}(&quot; some text&quot;) '' ''
{{CodeEnd}}
{{OutputStart}}some text
some text
{{OutputEnd}}
''Example 3:'' A TRIM$ function to trim spaces off of both ends of a string.
{{codeStart}} '' ''
text$ = &quot; Text String &quot;
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}}