Programming instructions
61
Intermec Fingerprint 6.13 – Programmer's Guide
6. FILE SYSTEM, cont'd.
10. Arrays, cont'd.
Continued!
SORT
The SORT statement is used to sort a one-dimensional array in
ascending or descending order according the character's ASCII
values in the Roman 8 character set. You can also choose between
sorting the complete array or a specified interval. For string arrays,
you can select by which character position the sorting will be
performed.
This example shows how one numeric array is sorted in ascending
order and one string array is sorted in descending order according
to the fifth character in each element:
10 FOR Q%=0 TO 3
20 A$=STR$(Q%)
30 ARRAY%(Q%)=1000+Q%:ARRAY$(Q%)="No. "+A$
40 NEXT Q%
50 SORT ARRAY%,0,3,1
60 SORT ARRAY$,0,3,-5
70 FOR I%=0 TO 3
80 PRINT ARRAY%(I%), ARRAY$(I%)
90 NEXT I%
RUN
Yields:
1000 No. 3
1001 No. 2
1002 No. 1
1003 No. 0
SPLIT
The SPLIT function is used to split a string expression into elements
in an array and to return the number of elements. A specified
character indicates where the string will be split.
In this example a string expression is divided into six parts by the
separator character “/” (ASCII 47 dec.) and arranged in a six
element array:
10 A$="ONE/TWO/THREE/FOUR/FIVE/SIX"
20 X$="ARRAY$"
30 DIM ARRAY$(6)
40 B%=SPLIT(A$,X$,47)
50 FOR C%=0 TO (B%-1)
60 PRINT ARRAY$(C%)
70 NEXT
RUN
Yields:
ONE
TWO
THREE
FOUR
FIVE
SIX