find , find ignore case , find ignore blanks , find ignore both
Searches the set for specified patterns and returns the character position number (0 = 1st character).
Indirect parameter passing is disabled
2-4
No. | Type | Description |
---|---|---|
1 input |
set | input set The elements inside the set provided will be compared during the search process. |
2 input |
valid types | matching value The comparison looks into both value and type. Providing a numeral 1 is not the same as a string '1'.
The set will be compared with this value in order to count matches.
The options 'ignore case', 'ignore blanks' and both combined will only apply if the values compared are strings. |
Opt. 3 input |
numeral | starting position Specify starting position to search. Eg. 1 excludes the 1st set selement. |
Type | Description |
---|---|
numeral | Position: Index to set element Positive or zero: Found and position returned. -1: Not found. |
echo( find( { a,b,c,A,B,C}, A ) ); // returns 3
echo( find ignore case ( { a,b,c,A,B,C}, A ) ); // returns 0
echo( find ignore case ( { a,b,c,A,B,C}, A, 1 ) ); // 3 (Skip first element in set)
echo( find( { {}, " ", 1, '1', {1} }, {} ) ); // returns 0 (2 empty sets compared)
echo( find( { {}, " ", 1, '1', {1} }, " " ) ); // returns 1 (blanks compared)
echo( find( { {}, " ", 1, '1', {1} }, "?" ) ); // returns -1 (not found)
echo( find( { {}, " ", 1, '1', {1} }, 1) ); // returns 2 (Numeral 1 compared)
echo( find( { {}, " ", 1, '1', {1} }, '1') ); // returns 3 (String 1 compared)
echo( find( { {}, " ", 1, '1', {1} }, {1} ) );// returns 4 (1 in nested set compared)
3
0
3
0
1
-1
2
2
4