17.08.2013 Views

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

Contents, cont'd. - Intermec

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

SPLIT<br />

Chapter 2 Program Instructions<br />

Field of Application Function splitting a string into an array according to the position of a<br />

specified separator character and returning the number of elements in<br />

the array.<br />

Syntax SPLIT(,,)<br />

1 2<br />

1<br />

2<br />

is the string to be split.<br />

is the string array in which the parts of the split string should<br />

be put.<br />

specifies the ASCII value for the separator.<br />

Remarks The string is divided by a specified separating character which may found an<br />

infinite number of times in the string. Each part of the string will become an<br />

element in the string array, but the separator character itself will not be<br />

included in the array.<br />

Should the string be split into more than four elements, an error will occur<br />

(Error 57 “Subscript out of range”). To avoid this error, issue a DIM<br />

statement to create a larger array before the string is split.<br />

Example In this example a string is divided into five parts by the separator character<br />

# (ASCII 35 decimal). The result will be an array of five elements numbered<br />

0–4 as specified by a DIM statement. Finally, the number of elements is also<br />

printed on the screen.<br />

10 A$="ONE#TWO#THREE#FOUR#FIVE"<br />

20 B$="ARRAY$"<br />

30 DIM ARRAY$(5)<br />

40 C%=SPLIT(A$,B$,35)<br />

50 PRINT ARRAY$(0)<br />

60 PRINT ARRAY$(1)<br />

70 PRINT ARRAY$(2)<br />

80 PRINT ARRAY$(3)<br />

90 PRINT ARRAY$(4)<br />

100<br />

RUN<br />

PRINT C%<br />

ONE<br />

TWO<br />

THREE<br />

FOUR<br />

FIVE<br />

5<br />

yields:<br />

<strong>Intermec</strong> Fingerprint 7.2 – Reference Manual Ed. 3 214

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!