trim: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function trim== Returns a copy of the string that is passed in with the leading and trailing white space removed. ===Usage=== <source lang="mtmacro" line> [h: str = string(str)] </sour...)
 
No edit summary
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Function trim==
{{MacroFunction
|name=trim
|version=1.3b48
|description=
Returns a copy of the string that is passed in with the leading and trailing white space removed.
Returns a copy of the string that is passed in with the leading and trailing white space removed.


|usage=
<syntaxhighlight lang="mtmacro" line>
trim(str)
</syntaxhighlight>
'''Parameter'''
{{param|str|The string that has its leading and trailing white space removed.}}


===Usage===
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: str = string(str)]
</source>
 
===Examples===
<source lang="mtmacro" line>
[r: ":" + trim("    this is a test") + ":"]
[r: ":" + trim("    this is a test") + ":"]
[r: ":" + trim("this is a test      ") + ":"]
[r: ":" + trim("this is a test      ") + ":"]
[r: ":" + trim("    this is a test      ") + ":"]
[r: ":" + trim("    this is a test      ") + ":"]
</source>
</syntaxhighlight>
Returns  
Returns  
     :this is a test:
     :this is a test:
     :this is a test:
     :this is a test:
     :this is a test:
     :this is a test:
|also=
{{func|substring}}
}}
[[Category:String Function]]

Latest revision as of 17:03, 14 March 2023

trim() Function

Introduced in version 1.3b48
Returns a copy of the string that is passed in with the leading and trailing white space removed.

Usage

trim(str)

Parameter

  • str - The string that has its leading and trailing white space removed.

Examples

[r: ":" + trim("     this is a test") + ":"]
[r: ":" + trim("this is a test      ") + ":"]
[r: ":" + trim("     this is a test       ") + ":"]

Returns

   :this is a test:
   :this is a test:
:this is a test:

See Also