INSTR()

INSTR(S1,S2)

RETURNS THE POSITION IN S1 OF THE FIRST CHARACTER OF S2 IF THE STRING S1 CONTAINS THE STRING S2

  • Type: Function
  • Parameters: 2
  • Group: Strings

ACTION

The function INSTR(S1,S2) returns the position in S1 of the first character of S2 if the string S1 contains the string S2, and otherwise returns 0.

SYNTAX: Result=INSTR(S1,S2)

  • S1 = string expression.
  • S2 = string expression.

USE

  • The function INSTR() is used to know the position of a string in another string.

ERROR

  • If S1 is not a correct string expression.
  • If S2 is not a correct string expression.

EXAMPLE

dim a$,b$

a$="ABCDEFGHIJ"

b$="DE"

print instr(a$,b$)

print 4

SEE ALSO

INSERT$()

LEFT$()

LEN()

LOWER$()

LTRIM$()

MID$()

RIGHT$()

RTRIM$()

STR$()

STRING$()

TRIM$()

UPPER$()