Programming instructions
Intermec Fingerprint v7.61 – Programmer’s Reference Manual Ed. 7 131
Chapter 2 Program Instructions
INSTR
Field of Application
Function searching a specifi ed string for a certain character, or
sequence of characters, and returning its position in relation to the
start of the string.
Syntax INSTR([<nexp>,]<sexp
1
>,<sexp
2
>)
<nexp> is , optionally, the position where the search will start.
<sexp
1
> is the string to be searched.
<sexp
2
> is the character(s) for which the string will be searched.
Remarks
INSTR allows you to search a string for some particular character(s) and return
the position of the character, or the fi rst character in the sequence, as a number
of characters positions measured from the start of the string.
As an option, it is possible to specify a certain position in the string from
which the search will start. If no start position is specifi ed, the search will
start at the beginning of the string.
The result will be zero if
- the start position value exceeds the length of the string.
- the string is empty.
- the searched combination of characters cannot be found.
Examples
In this example, the string "INTERMEC_PRINTER_AB" is searched for the
character combination "AB". No start position is specifi ed.
10 A$="INTERMEC PRINTER AB"
20 B$="AB"
30 PRINT INSTR(A$,B$)
RUN
yields:
18
In next example, the string "INTERMEC_PRINTER_AB" is searched for the
character "I" and the start position is specifi ed as 4.
10 A$="INTERMEC PRINTER AB"
20 B$="I"
30 PRINT INSTR(4,A$,B$)
RUN
yields:
12