&&index: Difference between revisions

From m204wiki
Jump to navigation Jump to search
(Created page with "__TOC__ {| |width="50%"| '''Action:''' |width="50%"| Returns the 1-based position of the ''needle'' argument within the ''haystack'' argument, or it returns 0 if the ''needle...")
 
(No difference)

Latest revision as of 15:33, 19 August 2022

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