listFind: Difference between revisions
Jump to navigation
Jump to search
(New page: ==Function listFind== Returns the index of the first occurrence of a value in a string list. If the value is not found then -1 is returned. ===Usage=== <source lan...) |
(→Usage) |
||
Line 5: | Line 5: | ||
===Usage=== | ===Usage=== | ||
<source lang="mtmacro" line> | <source lang="mtmacro" line> | ||
[h: ind = | [h: ind = listFind(list, value)] | ||
[h: ind = | [h: ind = listFind(list, value, delim)] | ||
</source> | </source> | ||
Revision as of 02:14, 29 January 2009
Function listFind
Returns the index of the first occurrence of a value in a string list. If the value is not found then -1 is returned.
Usage
[h: ind = listFind(list, value)]
[h: ind = listFind(list, value, delim)]
If delim is not specified then the default value of ',' is used as the value separator in the string list
Example
[r: listFind("This, is, a, test", "is")]
Returns 1
[r: listFind("This: is: a: test", "a", ":")]
Returns 2
[r: listFind("This, is, a, test", "not")]
Returns -1