EasyManua.ls Logo

Texas Instruments TI-99/4A - Page 122

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...
SEG$
-
String
Segment
SEG
$(s
tring'express
ion.
numeric'expression
1,
numeric-expression2)
The
string
segment
function gives you a portion (substring)
of
{he
string
designated
by the string-expression. Numeric-expression]
identifies the position
of
the
character
in the original
string
which
is
the first
character
of
the
substring.
The
position
of
the
first
character
in the
string
specified is position one.
The
length of the
substring
is specified by numeric·expression2.
The
normal
rules for
the evaluation
of
numeric
expressions
and
string
expressions
are
used
here.
For
this discussion, A$ is used for string'expression, X is
used
for
numeric'expression]
and
Y is used for numeric-expression2.
If
you
specify a value for X which is
greater
than
the length
of
A$ (line
110)
or
a value of zero for Y (line 120),
then
you
are
given the null
string.
If
you specify a value for Y which
is
greater
than
the
remaining
length in A$
starting
at
the position specified by X (line
130),
then
you
are
given the
rest
of
A$
starting
at
the position
specified by
X.
If
you specify a value for X which is less
than
or
equal to zero
and/
or specify a value for Y
which
is less
than
z;ero,
then the
message
"BAD
VALUE"
is
displayed
and
the
program
stops
running.
II·102
Examples:
>NEW
>100
MSG$="HELLO
THERE!
HOW'"
RE
VOU?"
>110
REM
SUBSTRING
BEGINS
IN
POSITION 14
"'ND
HAS
A
LENGTH
OF
12
~120
PRINT
SEr,$(MSG$,14,1Z)
>130
END
>RUN
HOW
ARE
YOU?
**
DONE
**
>NEW
>100
MSG$="1
AM
A
COMPUTER."
>110
PRINT
SEG$(MSGS,20,1)
>120 PRINT SEG$(MSG$,10,O)
>130 PRINT
SEG$(MSGS,8,20}
>140
END
>RUN
COMPUTER.
**
DONE
**
>PRINT
SEG$(MSG$,-1,10l
*
BAD
VALUE
User's
Reference
Guide

Other manuals for Texas Instruments TI-99/4A

Related product manuals