Programming instructions
97
Intermec Fingerprint 6.13 – Programmer's Guide
9. DATA HANDLING, cont'd.
2. Input Data Conversion,
cont'd.
STR$
The STR$ function returns the string representation of a numeric
expression. The complementary instruction is VAL.
Example:
10 A%=123
20 A$=STR$(A%)
30 PRINT A%+A%
40 PRINT A$+A$
RUN Yields:
246
123123
STRING$
The STRING$ function returns a specified number of a single
character specified either by its ASCII value or by being the first
character in a string expression.
Example:
10 A$="*THE END*"
20 FIRST$=STRING$(4,42)
30 LAST$=STRING$(4,A$)
40 PRINT FIRST$+A$+LAST$
RUN Yields:
*****THE END*****
VAL
The VAL function returns the numeric representation of a string
expression. The complementary instruction is STR$.
VAL is for example used in connection with random files, which
only accept strings (see chapters 7.5 and 8.4). Thus numeric
expressions must be converted to string format using STR$ before
they are PUT in a random file and be converted back to numeric
values using VAL after you GET them back from the file.
Another application is when you want to calculate using data in a
string expression, e.g. when reading the printer's clock (also see
chapter 9.3).
Example of using the priner as an alarm clock (requires either a
real-time clock or that the time has been set manually):
10 INPUT "Set Alarm"; A%
20 B%=VAL(TIME$)
30 IF B%>=A% THEN GOTO 40 ELSE GOTO 20
40 SOUND 880,100: END
RUN