substring: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function substring== Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. If the end parameter is not specified then the substring exte...)
 
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function substring==
{{MacroFunction
 
|name=substring
|description=
Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. If the end parameter is not specified then the substring extends to the end of the string.
Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. If the end parameter is not specified then the substring extends to the end of the string.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: str = substring(str,  start)]
[h: str = substring(str,  start)]
Line 9: Line 10:
</source>
</source>


 
|examples=
===Example===
<source lang="mtmacro" line>
<source lang="mtmacro" line>
     [substring("This is a test", 5)]
     [substring("This is a test", 5)]
Line 18: Line 18:
     is a test
     is a test
     is
     is
}}
[[Category:String Function]]

Revision as of 05:24, 9 March 2009

substring() Function

Returns the substring of the string from the start to the end indexes. Indexes for strings start at 0. If the end parameter is not specified then the substring extends to the end of the string.

Usage

[h: str = substring(str,  start)]
[h: str = substring(str,  start, end)]

Examples

    [substring("This is a test", 5)]
    [substring("This is a test", 5, 7)]

Returns

   is a test
is