InStr – String Management Function**





InStr Function


Description

The InStr function returns the position of a string within another string.

Usage

Used to find out if one set of characters (a string) is contained in another.

Syntax

var = InStr(<source_string>, <string_to_search>)

Parameters

<source_string>: string that will be searched.

<string_to_search>: string to search for.

Return Value

var, integer, position of the first occurrence of <string_to_search> in <source_string>. If no occurrence is found, the return value is 0.

Remarks

Use this function in an If...EndIf block to test if a text is in a string or not.

Examples


pos = InStr("abcdefg", "de") ' returns 4
pos = InStr("abcdefg", "dz") ' returns 0