find ... (parameter set function)

Prev Next

Function Names

find , find ignore case , find ignore blanks , find ignore both

Description

Searches the parameter set for specified patterns and returns the character position number (0 = 1st character).

Call as: function

Restrictions

Indirect parameter passing is disabled

Parameter count

2-4

Parameters

No.TypeDescription
1
input
parameter set input parameter set

The elements inside the parameter set provided will be compared during the search process.
Attention: If 1st parameter is not a parameter set, please refer to find [string function] instead.

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 parameter 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.
If the value is an unquoted string or softquoted string, then wildcard symbols are supported.

Opt. 3
input
numeral starting position

Specify starting position to search. Eg. 1 excludes the 1st parameter set selement.
Negative numbers are supported: -1 = last element, -2 = previous element, etc..

Default value: 0

Return value

TypeDescription
numeral Position: Index to parameter set element

Positive or zero: Found and position returned. -1: Not found.

Examples

      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 parameter 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 parameter set compared)

Output

3
0
3
0
1
-1
2
2
4
Try it yourself: Open LIB_Function_find_.b4p in B4P_Examples.zip. Decompress before use.

See also

find [string function]