&&index

From m204wiki
Jump to navigation Jump to search
Action:

Returns the 1-based position of the needle argument within the haystack argument, or it returns 0 if the needle value is not found within the haystack value.

If fewer than two arguments are specified, an error is issued.

Syntax:

&&index(haystack,needle

where the haystack and needle arguments observe the rules for &&function string arguments.

For example, the first &&index call in the following fragment would return 3; the second would return 0:

set &g = 'george'  &&index(&g,'or')  &&index('moe', 'x') 

Introduced: Build 58