Programming instructions
Intermec Fingerprint v7.61 – Programmer’s Reference Manual Ed. 7 245
Chapter 2 Program Instructions
SPLIT
Field of Application
Function splitting a string into an array according to the position
of a specifi ed separator character and returning the number of
elements in the array.
Syntax SPLIT(<sexp
1
>,<sexp
2
>,<nexp>)
<sexp
1
> is the string to be split.
<sexp
2
> is the string array in which the parts of the split string
should be put.
<nexp> specifi es the ASCII value for the separator.
Remarks
The string is divided by a specifi ed separating character which may found
an infi nite number of times in the string. Each part of the string will
become an element in the string array, but the separator character itself
will not be included in the array.
Should the string be split into more than four elements, Error 57, “Subscript
out of range” will occur. To avoid this error, issue a DIM statement to create
a larger array before the string is split.
Example
In this example a string is divided into fi ve parts by the separator character
# (ASCII 35 decimal). The result will be an array of fi ve elements numbered
0-4 as specifi ed by a DIM statement. Finally, the number of elements is
also printed on the screen.
10 A$="ONE#TWO#THREE#FOUR#FIVE"
20 B$="ARRAY$"
30 DIM ARRAY$(5)
40 C%=SPLIT(A$,B$,35)
50 PRINT ARRAY$(0)
60 PRINT ARRAY$(1)
70 PRINT ARRAY$(2)
80 PRINT ARRAY$(3)
90 PRINT ARRAY$(4)
100 PRINT C%
RUN
yields:
ONE
TWO
THREE
FOUR
FIVE
5