SQL iQuery Script Built-in Functions

Find First Of a List of Characters

FindFirstOf, firstOf

The findFirstOf() built-in functions returns the position of the first character in the session variable that is any of the characters among the first parameter.

Syntax

The findFirstOf built-in function scans the 2nd parameter for any of the characters specified on the first parameter, beginning at the optional starting position.

Parameters

  1. Variable or quoted character string that is the list of characters to be located.
  2. The Session Variable that is searched.
  3. The starting position within the Session Variable (2nd parameter) to begin the scan.
eval &digits = '0123456789';
eval &partnbr = 'THX1128';
eval &part = findFirstOf(&digits, &partNbr);
#msg The part number digit appears in pos &part

The output written to the joblog is:

The part number digit appears in pos 4

If none of the characters are found, the result is 0.