EasyManua.ls Logo

Texas Instruments TI-99/4A - Page 121

Texas Instruments TI-99/4A
204 pages
Print Icon
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...
LEN - Length
LEN
(string-expression)
The
length function gives you the
number
of character::; ill the
:strillg,
specified by
the
argument.
The
argument
is
the
string
value
obtained
when
the string'expression is evaluated.
The
normal
rules
for the evaluatIOn ot
stnng
expressions
are
used here.
The
length
of a null
string
is zero.
Remember
that
a
space
is
a
character
and
counts
as
part
of the length.
Examples:
>NEW
>100
NAME$="CATHY"
;.110
ClTY$="NEW
yORK"
>120
MSG$="HELLO
"&"THERE!"
>130 PRINT
NAME$;LEN(NAMES)
>140 PRINT CITY$;LEN(CITY$)
;.150
PRlNT
MSGS;LEN(MSGS}
>160 PRINT LEN(NAMES&CITY$)
>170
PRINT
LEN("HI!")
>180
STOP
>RUN
CATHY
5
NEW
YORK
8
HELLO
THERE!
12
13
3
**
DONE
**
POS
-
Position
POS(strin,g·},strin,g-;},numeric-expression)
The
position function finds
the
first
occurrence
of
string'2 within
string-I. Both string·]
and
string'2
are
string
expressions.
The
numeric-expression is
evaluated
and
rounded, if necessary, to
obtain
an
integer,
n.
The
normal rules for the evaluation of
string
expressions
and
numeric
expressions
arc
used here,
The
search
for string-2 begins
at
the nth
character
of string-I.
If
string-2 is
found,
the
character
position within string-] of the first
character
of string-) is given.
If
string·) is not found, a value of zero is
given.
The
position of the first
character
in string-} is position
one.
If
you specify a value for n which is
greater
than
the
number
of
characters
in string-], a value
of
zero is given.
If
the value
specified
for
n is less
than
zero.
the
message "BAD VALUE" is
displayed
and
the
program
stops
running.
User's
Reference
Guide
>NEW
>100
MSG$="HELLO
THERE!
HOW
A
RE
YOU?"
>110 PRINT
"H";POS(fllSGS,"H",1
)
>120 C$="RE"
>130
PRINT
C$iPOS(MSG$,C$,1);
POS(MSG$,CS,12)
>140
PRINT
"Hl";POS(MSGS,"HI"
, 1 )
>150
END
>RUN
H 1
RE
10 19
HI
0
**
DONE **
11-101

Other manuals for Texas Instruments TI-99/4A

Related product manuals