<<

Contents

Search

>>

 

INSTR

 

 

Function

 

 

Syntax:

INSTR([<From Position>,]<Search In>,<Look For>)

 

<From Position>

= <NUM-EXPRESSION>

<Search In>

= <STRING-EXPRESSION>

<Look For>

= <STRING-EXPRESSION>

 

 

Meaning:

Returns the position of a substring.

 

Searches for the first occurrence of the character string <Look For> in <Search In>. If <From Position> is specified, the character string <Search In> is searched from this position, otherwise from position 1. The result of the function is 0 if the character string <Look For> has not been found, otherwise the position found in <Look For> is returned. It is counted from 1 upward.

 

Parameter:

From Position

Position from which the string is to be searched.

Search In

String that is to be searched.

Look For

String that is to be found.

 

Sample:

H$ = "TESTTEST"

I% = INSTR(3,H$,"TEST") /* I% = 5

K% = INSTR(H$,"TEST")   /* K% = 1

 

See also:

INSTR_COUNT

MID$

SUBSTR$

DELSUBSTR$

REPLSTR$