EasyManuals Logo
Home>Atari>Desktop>800

Atari 800 Basic Reference Manual

Atari 800
122 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #46 background imageLoading...
Page #46 background image
LEN
STR$
VAL
38
Strings
10
FOR
I=0
TO
25
~'0
PR
I
HT
CHfU(
ASC(
..
A
11
)+I ) )
CHF.:$(
A:
:;C(
"a"
)+
I)
30
t·~E>=:T
I
Figure
7-2.
ASC
and
CHR$
Program
Example
Note:
There
can
be
only
one
STR$
and
only
one
CHR$
in
a logical
comparison.
Format:
LEN (sexp)
Example:
100 PRINT LEN(A$)
This
function
returns
the
length
in
bytes
of
the
designated
string
.
This
informa-
tion
may
then
be
printed
or
used
later
in
a
program.
The
length
of
a
string
variable
is
simply
the
index
for
the
character
which
is
currently
at
the
end
of
the
string
.
Strings
have
a
length
ofO
until
characters
have
been
stored
in
them.
It
is
possible
to
store
into
the
middle
of
the
string
by
using
sub
sc
ripting.
However,
the
beginning
of
the
string
will
contain
garbage
unless
something
was
stored
(using
STO)
there
previously.
The
following
routine
illustrates
one
use
of
the
LEN
function:
10
Dir-1
A!(
10
>
2~3
A:i=u
AT
A~~
In
3(
1
F'~~
I
f
-~T
LEt·i<
A$
>
Figure
7-3.
LEN
Function
Example
The
result
ofrunning
the
above
program
would
be
5.
Format:
Example:
STR$ (aexp)
A$=
STR$(65)
This
string
from
number
function
returns
the
string
form
of
the
number
in
parentheses
.
The
above
example
would
return
the
actual
number
65,
but
it
would
be
recognized
by
the
computer
as a
str
ing
.
Note:
There
can
only
be
one
STR$
and
only
one
CHR$
in
a logical
comparison.
F
or
exa
mple
,
A=
STR$(1) > STR$(2) is
not
valid
and
will
not
wor
k cor:rectly.
Format:
VAL(sexp)
Example:
100 A = V AL(A$)
This
function
returns
a
number
of
the
same
value
as
the
number
stored
as
a
string.
This
is
the
opposite
of
a STR$
function.
Usi
ng
this
function
,
the
computer
can
perform
arithm
e
ti
c
operations
on
strings
as s
ho
w n
in
th
e
following
e
xam-
ple
program:
10
DH1
8$(5)
20
B:f.:
II
10(10(11!
30
E:=SG!~\
I..JAL(
B$) )
40
PRHH
11
THE
SQUAPE
POOT
OF
II ,
;8$
.;
II IS
II
jB
Figure
7-4.
VAL
Function
Program

Table of Contents

Other manuals for Atari 800

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Atari 800 and is the answer not in the manual?

Atari 800 Specifications

General IconGeneral
BrandAtari
Model800
CategoryDesktop
LanguageEnglish

Related product manuals