Skip to main content

ListFindFirst

Use this function to search a list for the first occurrence of a specified value and return the index of the match.

Syntax:

ListFindFirst(list, find)

where:

  • list is a variable of type NUM[], STRING[], or RANGE.
  • find is the value to search for or a variable of the same type as list that contains the values to search for in list. If you are searching for a string value, you must enclose it in double quotation marks.

Syntax example:

CREATE VARIABLE myList1[] AS STRING

CREATE VARIABLE nResult AS NUM

CREATE VARIABLE bResult AS NUM

CREATE VARIABLE sValue AS STRING

SET VARIABLE myList1 = "a|b|c|d|e|f"

SET VARIABLE sValue = "d"

SET VARIABLE nResult = ListFindFirst(myList1, sValue)

SET VARIABLE bResult = ListFindFirst(myList1, "b")

// In this example, nResult equals 4 and bResult equals 2.

Was this article helpful?

We're sorry to hear that.