FIND
FIND

# FIND

This function will find an element of a string array that contains an identified search string. Format
FIND(A\$, B\$)
FIND(A\$, B\$, START)
FIND(A\$, COLUMN, B\$)
FIND(A\$, COLUMN, B\$, START)
Parameters
• A\$ = string array to search for B\$.
• B\$ = string to search for within A\$.
• START = index within a single dimensional array, or row for a two dimensional array, to start the search.
• COLUMN = column to isolate search to in a two dimensional array. This must be supplied if A\$ is a two dimensional array.
Returns
Returns a 0 if B\$ is not found or if there was an error. Otherwise, returns the index that contains the first occurrence of the string B\$ (the element index for one dimensional arrays, the row for two dimensional arrays).
Example
This example shows how to find a string in a one dimensional array.
```10 DECLARE STRING NAMES\$(4)
20 LET NAMES\$(1) = "Fred"
30 LET NAMES\$(2) = "Wilma"
40 LET NAMES\$(3) = "Barney"
50 LET NAMES\$(4) = "Betty"
60 LET BARNEYIX = FIND(NAMES\$, "Bar")
70 PRINT "Found Barney in element "; STR\$(BARNEYIX) ```
Example
This example shows how to find a string that occurs more than once in a two dimensional array.
```10  DECLARE STRING CLOTHING\$(5,2)
20  LET TYPECOL     = 1
30  LET MATERIALCOL = 2
40  LET CLOTHING\$(1,1) = "Gloves"
50  LET CLOTHING\$(1,2) = "Knit"
60  LET CLOTHING\$(2,1) = "Pants"
70  LET CLOTHING\$(2,2) = "Cotton"
80  LET CLOTHING\$(3,1) = "Gloves"
90  LET CLOTHING\$(3,2) = "Leather"
100 LET CLOTHING\$(4,2) = "Shirts"
110 LET CLOTHING\$(4,2) = "Polyester"
120 LET CLOTHING\$(5,2) = "Pants"
130 LET CLOTHING\$(5,2) = "Denim"
140 LET GLOVEIX = 1
150 DO
160 LET GLOVEIX = FIND(CLOTHING\$, TYPECOL, "Gloves", GLOVEIX)
170 IF NOT GLOVEIX = 0 THEN
180 PRINT CLOTHING\$(GLOVEIX, MATERIALCOL), "gloves are available"
190 LET GLOVEIX = GLOVEIX + 1
200 END IF
210 LOOP WHILE NOT GLOVEIX = 0 ```
```5 DECLARE STRING A\$(5)