BASIC-SO
MID$
The MID$(X$,1. [,J]) function examines string
X$
and
returns the rightmost
characters starting
at
pointer
1.
I
and
J are integers in the range 1-255.
If
argument J
is
specified, J characters are returned, starting
at
position
1.
If
I
is
greater
than
LEN(X$), the MID$ function returns the null string.
If
argument J
is
greater
than
the number
of
characters in X$ to the right
of
I or
is
not specified, MID$ returns the
rest
of
the
string.
MID$(string expression, expression [,expression])
10
X$
=
"JOHN
J.
JONES"
20
PRINT MID$(X$,10,3)
30
PRINT MID$(X$,9)
40
END
RUN
ONE
JONES
Ok
The MID$ (X$,
1.
[,J]) function may also appear on the left side
of
an assignment
statement. Employed in this context, it will replace the characters
of
string X$ begin-
ning
at
position I with the string given
on
the right.
If
J is specified, J characters
of
X$
are replaced.
If
I
is
greater then LEN(X$) , an illegal function call error
is
displayed. The length
of
X$
is
never changed.
10
A$
=
"ABCDEF"
20
B$
=
"XXYYZZ"
30
MID$(A$,2,4) =
B$
40
PRINT
A$
50
END
RUN
AXXYYF
Ok
MKI$ MKS$ MKD$
The three functions MKI$, MKS$, and MKD$ convert
data
represented as
numerical values into two-, four-,
or
eight-byte strings, respectively. MKI$
is
used
to
convert
an
integer value; MKS$
is
used
to
convert a single-precision floating-poinf
value; and MKD$
is
used
to
convert a double-precision floating-point value.
MKI$ (integer)
MKS$ (single-precision value)
MKD$ (double-precision value)
These functions are used to place numeric values into fields
of
random file buffers.
See Chapter 5 for discussion
of
MKI$, MKD$, and MKS$
OCT$
The
aCTS
function returns a string
of
octal digits which represent the value
of
the
integer argument.
The
expression
is
rounded to an integer before conversion.
OCT$
(expression)
10
PRINT "TYPE DECIMAL INTEGER
TO
BE
CONVERTED."
20
INPUT A
30
A$
= OCT$(A)
40
PRINT
A,"EQUALS,"A$,"
IN
OCTAL."
Functions
7-9