listContains: Difference between revisions
Jump to navigation
Jump to search
Verisimilar (talk | contribs) (Completed the article.) |
No edit summary |
||
(2 intermediate revisions by one other user not shown) | |||
Line 6: | Line 6: | ||
|usage= | |usage= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
listContains(list, value) | listContains(list, value) | ||
listContains(list, value, delim) | listContains(list, value, delim) | ||
</ | </syntaxhighlight> | ||
'''Parameters''' | '''Parameters''' | ||
{{param|list|The [[String List]] that is checked for occurrences of the {{code|value}}.}} | {{param|list|The [[String List]] that is checked for occurrences of the {{code|value}}.}} | ||
Line 16: | Line 16: | ||
|examples= | |examples= | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[r: listContains("a,b,c,a,b,a", "a")] | [r: listContains("a,b,c,a,b,a", "a")] | ||
</ | </syntaxhighlight> | ||
Returns {{code|3}} | Returns {{code|3}} | ||
< | <syntaxhighlight lang="mtmacro" line> | ||
[h: MyStringList = "1#2#3#4#1#2#3#1#2"] | [h: MyStringList = "1#2#3#4#1#2#3#1#2"] | ||
[r: listContains(MyStringList, "3", "#")] | [r: listContains(MyStringList, "3", "#")] | ||
</ | </syntaxhighlight> | ||
Returns {{code|2}} | Returns {{code|2}} | ||
Latest revision as of 17:47, 15 March 2023
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