listCount: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
(New page: ==Function listAppend== Returns the number of items in a Macros:string list. ===Usage=== <source lang="mtmacro" line> [h: count = listCount(list, value)] [h: count = listCount(list, ...)
 
No edit summary
 
(10 intermediate revisions by 5 users not shown)
Line 1: Line 1:
==Function listAppend==
{{MacroFunction
|name=listCount
|version=1.3b42
|description=
Returns the number of items in a [[Macros:string list|string list]].


Returns the number of items in a [[Macros:string list|string list]].
|usage=
===Usage===
<syntaxhighlight lang="mtmacro" line>
<source lang="mtmacro" line>
listCount(list)
[h: count = listCount(list, value)]
</syntaxhighlight>
[h: count = listCount(list, value, delim)]
<syntaxhighlight lang="mtmacro" line>
</source>
listCount(list, delim)
</syntaxhighlight>


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===
|examples=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: listCount("This, is, a, test")]
[r: listCount("This, is, a, test")]
</source>
</syntaxhighlight>
Returns 4
Returns 4


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[r: listCount("This: is: a: test")]  
[r: listCount("This: is: a: test",":")]  
</source>
</syntaxhighlight>
Returns 4
Returns 4
}}
[[Category:String List Function]]

Latest revision as of 23:59, 15 March 2023

listCount() Function

Introduced in version 1.3b42
Returns the number of items in a string list.

Usage

listCount(list)
listCount(list, delim)

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

Examples

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

Returns 4

[r: listCount("This: is: a: test",":")]
Returns 4