INSTR()

 

Syntax:

       Then: a = INSTR(n,m,s)

 

Looks for field "m" in field "n" starting at position "s". The starting location in field "n"is returned as a number in field "a"; return value is "0" if field "m" is not found in field "n";

   

"a" is the return value

"n," "m," and "s" are expressions; "n" is the field you are searching
"m" is the field you are looking for
"s" (optional) is the character position in field "n" from which to start the search.

 

If the field is not found, INSTR returns a zero.

Examples:

Then: a = "The quick, brown fox jumped over the lazy dog."

Then: b = "fox"

Then: x = INSTR(a,b) ' x will contain 18.

Then: x = INSTR(a," ") ' x will contain 4.

Then: x = INSTR(a," ","20") ' x will contain 21.

 

Version Ref: 4.1

 

Description:

INSTR looks for the contents of one field within a second field, beginning at a specified character position. INSTR returns the character position in the second field where the first field is found. INSTR can be used in an expression.

 

Version 6.0.01

 

RINSTR, and INSTR now allows negative positions for working backwards.

 

RINSTR(n,m)

RINSTR(n,m,s)

Search for m in n.

Searches backwards from string length or position s.

INSTR(n,m,s)

"s" (optional) is the character position in field "n" from which

to start the search.

NEW: If you use "-1" as the position it will scan backwards

from the end of the string and return the position if m is found.