INSTR/WINSTR

Top  Previous  Next

Syntax

UINT = INSTR(target as STRING,search as STRING,OPT pos = 1 as UINT)

UINT = WINSTR(target as WSTRING,search as WSTRING,OPT pos = 1 as UINT)

Description

Finds the first occurrence of a search string in a target string.

Parameters

target - String to perform the search on.

search - String to search for.

pos - Optional ones based starting position to begin the search.

Return value

Returns the ones based position of the first occurrence of the search string in the target string. Returns 0 if the search string could not be found.

Remarks

Parameters of INSTR are different from other languages.

Example usage

A$ = "A string to search for something"
PRINT INSTR(A$,"search")