44
CipherLab BASIC Programming Part I
OCT$
Purpose
To convert a decimal numeric expression to a string that represents the value
of the numeric expression in octal notation.
Syntax A$ = OCT$(N%)
Remarks “A$” is a string variable to be assigned to the result.
“N%”
is a numeric expression in the range 0 to 2,147,483,647; it is rounded to
an integer before OCT$(N%) is evaluated.
Example
STR$
Purpose To convert a numeric expression to a string.
Syntax A$ = STR$(N%)
Remarks “A$” is a string variable to be assigned to the result.
“N%” is a numeric expression.
Example
UCASE$
Purpose To return a copy of a string in which all lowercase letters will be converted
uppercase letters.
Syntax A$ = UCASE$(X$)
Remarks “A$” is a string variable to be assigned to the result.
“X$” may be a string variable, string expression, or string constant.
Example
String1$ = “John Thomas”
String2$ = UCASE$(String1$)
‘ String2$ = “JOHN THOMAS”
VAL
Purpose To return the numeric value of a string expression in long integer form.
Syntax A& = VAL$(X$)
Remarks “A&” is an integer or long integer variable to be assigned to the result.
“X$” is a string that includes numer
ic characters. If the first character is not
numeric, this command returns 0.
The command VAL will strip leading blanks, tabs, and linefeeds from the
argument string. The return numeric value is in the range of –
to 2,147,483,647.
Example
ON HOUR_SHARP GOSUB OnHourAlarm
…
OnHourAlarm:
Hour% = VAL(LEFT$(TIME$, 2))
FOR Counter% = 1 TO Hour%
BEEP(800, 50)
WAIT(200)
NEXT