EasyManua.ls Logo

Sharp MZ-700 - String Function

Sharp MZ-700
213 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
Loading...
2.5
String Function
2.5.1
LEN
I Format
Function
Example
LEN (X$)
X$ . . . String expression
This funcion returns the number
of
characters included in
the
string expression
represented
by
X$. This value includes spaces which are
not
displayed
on
the screen
and any control characters in
the
string,
as
well
as
letters, numerals,
and
symbols.
(Example
1)
1 0
A$=
aAB
COE
FG "
2 0 P
RINT
LE
N C
A$
)
RUN
7
(Example 2) The following program uses
the
LEN funcition to draw squares on the
screen.
1 0
9
"
~
"
:?
"
ENTER
30R
MORE
AS
T
ER
I
SKS
"
2 0
INP
UT
A$
3 0 FOR 1= 1 TO LEN C
A$)-2
4 0 P R I NT TA B
C2)
; " * " ; S PC CLEN C
A$)
-2)
" * "
5 0 NEX T I
6 0
PRINT
TAB
C2)
;
A$
: GOTO 2 0
(Example 3)
The
LEN function can also be used to produce a
"parade"
of
charac-
ters
as
shown below.
1 0
S$
= "S H
ARP
BASIC
"
20
FOR
1
=1
TO
LEN
C
S$)
30
9 R IGHT
$CS$.
I)
4 0 NE XT
5 0 END
RUN
c
IC
SIC
S HA
RP
BAS
IC
(Example 4)
PRINT
LEN
CS
TR$
CPA I C1 ))) J
g
PAl
(1)
, the function which returns the value
of
the ratio
of
the circumference
of
a
circle
to
its diameter, contains the 8-digit constant
3.1415927
(approximately the
value
of
PI). When the length
of
the character string produced
by
converting this
constant with the STR$ function
is
evaluated with the LEN function, a
total
string
length
of
9
is
returned.
76
--------
--------
------------------
----------------
--------
--
---------

Other manuals for Sharp MZ-700

Related product manuals