# Search String

Searches for a string (exact match).

##### Block

##### Text

TARGET = findString(EXPRESSION, SOURCE_ARR);
3 1 2

# | Description
1 | [Search String] Set the string to search for. The search string is case sensitive.
2 | [String Array to Search] Set an internal one-dimensional array of strings that will be searched. Note: You cannot search external array variables. You cannot search multidimensional array variables.
3 | [Result(Index)] Set an INT variable where the array element number of the string that exactly matches the [Search String] is stored. If there are multiple string array elements that match, the smaller element number is stored. If there are no matches, -1 is stored.

(Example)

##### Block

##### Text

Var1 = findString(Var3, Var6);

## Operation Example

[Search String] | Element number and string in the array variable | Array element number stored in [Result(Index)] | Comments
ABC | 0: ABCDE 1: ABCD 2: ABC | 2 | Searches for an exact match.
0: abc 1: ABCD 2: ABC | 2 | Case sensitive.
0: ABC 1: ABCD 2: ABC | 0 | If there is more than one array element that matches, the smaller element number is stored.
0: ABCDE 1: ABC(0x00)D 2: ABC | 1 | If there is a NULL (0x00), the string is terminated there.
0: AB 1: abc 2: ABCD | -1 | If there is no matching string, -1 is stored.
ABC(0x00)D | 0: ABCDE 1: ABCD 2: ABC | 2 | If there is a NULL (0x00), the string is terminated there.