_TRIM$

From QB64 Wiki
Revision as of 10:14, 15 July 2020 by Ashish (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The _TRIM$ function removes both leading and trailing space characters from a STRING value.


Syntax

return$ = _TRIM$(text$)


Description

  • Shorthand to using LTRIM$(RTRIM$("text"))
  • text$ is the STRING value to trim.
  • If text$ contains no leading or trailing space characters, it is returned unchanged.
  • Convert fixed length STRING values by using a different return$ variable.


Examples

Example: Demonstrating how _TRIM$(text$) can replace LTRIM$(RTRIM$(text$)):

text$ = SPACE$(10) + "some text" + SPACE$(10) PRINT "[" + text$ + "]" PRINT "[" + RTRIM$(text$) + "]" PRINT "[" + LTRIM$(text$) + "]" PRINT "[" + LTRIM$(RTRIM$(text$)) + "]" PRINT "[" + _TRIM$(text$) + "]"

[ some text ] [ some text] [some text ] [some text] [some text]


See also



Navigation:
Go to Keyword Reference - Alphabetical
Go to Keyword Reference - By usage
Go to Main WIKI Page