listContains: Difference between revisions
Jump to navigation
Jump to search
mNo edit summary |
Verisimilar (talk | contribs) (Completed the article.) |
||
Line 1: | Line 1: | ||
{{MacroFunction | {{MacroFunction | ||
|name=listContains | |name=listContains | ||
|version=1.3b42 | |||
|description= | |description= | ||
Returns number of occurrences of a value in a | Returns the number of occurrences of a value in a [[String List]]. | ||
|usage= | |usage= | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
listContains(list, value) | |||
listContains(list, value, delim) | |||
</source> | </source> | ||
'''Parameters''' | |||
{{param|list|The [[String List]] that is checked for occurrences of the {{code|value}}.}} | |||
{{param|value|The value to search the [[String List]] for occurrences.}} | |||
{{param|delim|The delimiter that separates the values in the [[String List]]; defaults to {{code|","}}.}} | |||
|examples= | |||
<source lang="mtmacro" line> | |||
[r: listContains("a,b,c,a,b,a", "a")] | |||
</source> | |||
Returns {{code|3}} | |||
<source lang="mtmacro" line> | |||
[h: MyStringList = "1#2#3#4#1#2#3#1#2"] | |||
[r: listContains(MyStringList, "3", "#")] | |||
</source> | |||
Returns {{code|2}} | |||
|also= | |||
{{func|listFind}} | |||
}} | }} | ||
[[Category:String List Function]] | [[Category:String List Function]] |
Revision as of 03:11, 2 June 2009
listContains() Function
• Introduced in version 1.3b42
Returns the number of occurrences of a value in a String List.
Usage
listContains(list, value)
listContains(list, value, delim)
Parameters
list
- The String List that is checked for occurrences of thevalue
.value
- The value to search the String List for occurrences.delim
- The delimiter that separates the values in the String List; defaults to","
.
Examples
[r: listContains("a,b,c,a,b,a", "a")]
Returns 3
[h: MyStringList = "1#2#3#4#1#2#3#1#2"]
[r: listContains(MyStringList, "3", "#")]
2