InStr

Syntax

InStr(within_string|substring)

Description

Locates a substring within a string of text and returns the starting position of the substring as an integer..

Parameters

Parameter Description

substring

The text you are searching for.

The string parameter is not case sensitive.

within_string

The text string you are searching within.

Returns

Returns an integer indicating the starting position of substring in within_string.

InStr returns 0 if substring does not appear in within_string. It returns 1 if substring is empty.

Example

The following table presents examples of using the InStr function.

Expression Result

instr(''ABCDEFG''|''c'')

3

instr(''ABCDEFG''|''C'')

3

instr(''ABCDEFG''|''CDE'')

3

instr(''ABCDEFG''|''zz'')

0

instr(''ABCDEFG''|)

1

instr(''ABCDEFG''|''A'')

1