INSTR_LAST()

INSTR_LAST(S1,S2)

RETURNS THE POSITION IN S1 OF THE LAST OCCURENCE OF S2, IF THE STRING S1 CONTAINS THE STRING S2

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

ACTION

The function INSTR_LAST(S1,S2) returns the position in S1 of the last occurence of S2, if the string S1 contains the string S2, and otherwise returns 0.

SYNTAX: Result=INSTR_LAST(S1,S2)

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

USE

  • The function INSTR_LAST() is used to know the last 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$="ABC DEF ABC"

b$="ABC"

print instr_last(a$,b$)

print 9

SEE ALSO

INSTR()

INSTR_POS()

INSTR_RIGHT()