listGet: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function listGet== Returns the value in the string list at the specified index. The index for a Macros:string list starts at 0. ===Usage=== <source lang="mt...)
 
m (Applied Template:MacroFunction)
Line 1: Line 1:
==Function listGet==
{{MacroFunction
 
|name=listGet
|description=
Returns the value in the [[Macros:string list|string list]] at the specified index. The index for a [[Macros:string list|string list]] starts at 0.
Returns the value in the [[Macros:string list|string list]] at the specified index. The index for a [[Macros:string list|string list]] starts at 0.


===Usage===
|usage=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[h: value = listGet(list, index)]
[h: value = listGet(list, index)]
Line 11: Line 12:
If delim is not specified then the default value of ',' is used as the value separator in the [[Macros:string list|string list]]
If delim is not specified then the default value of ',' is used as the value separator in the [[Macros:string list|string list]]


===Example===
|example=
<source lang="mtmacro" line>
<source lang="mtmacro" line>
[r: listGet("This, is, a , test", 2)]
[r: listGet("This, is, a , test", 2)]
Line 21: Line 22:
</source>
</source>
Returns is
Returns is
}}
[[Category:String List Function]]

Revision as of 02:50, 9 March 2009

listGet() Function

Returns the value in the string list at the specified index. The index for a string list starts at 0.

Usage

[h: value = listGet(list, index)]
[h: value = listGet(list, index, delim)]

If delim is not specified then the default value of ',' is used as the value separator in the string list

Example

[r: listGet("This, is, a , test", 2)]

Returns a

[r: listGet("This: is: a :test", 1, ":")]
Returns is