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...)
 
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function trim==
{{MacroFunction
|name=trim
|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=
===Usage===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: str = string(str)]
[h: str = string(str)]
</source>
</source>


===Examples===
|examples=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: ":" + trim("    this is a test") + ":"]
[r: ":" + trim("    this is a test") + ":"]
Line 18: Line 19:
     :this is a test:
     :this is a test:
     :this is a test:
     :this is a test:
}}
[[Category:String Function]]

Revision as of 05:37, 9 March 2009

trim() Function

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

Usage

[h: str = string(str)]

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: