Commodore 16 User Manual
Download Operation & user’s manual of Commodore 16 Desktop for Free or View it Online on All-Guides.com.
String Functions
String
luncnons
differ
from numeric functions in thai Ihey return
characters, graphics
or
numbers
from a stnng
(defined
by
quotation
marks) instead
of a
number.
CHR$(X)
This function returns a string character whose ASCII
code is X.
ERR$(N)
Returns
string
describing error condifion
N (see
TRAP)
HEXJ(N)
Returns
a
4 character string
containing the hexadecimal representation
of value
N
(0
<
N
<
65535)
LEFT$(X$,X)
This returns
a
string containing
the
leftmost
X characters of X$.
LEN(X$)
Returns the number
of characters (including
spaces
and other symbols)
in tne siring
X$
1
50
I
I
I
I
I
I
[
f
I
I
f
MIDS(X$,N,X)
This
returns a
string
containing X
characters, starting from the Nth
character
in XS. MIDS can
also
be used
on the left side of assignment
statement
as a
pseudo-variable
as
well
as a
function. MIDS {string
variable, starting position, length)
=
source siring.
This function
reassigns
values
of positions (starting position) through
(starling position
+
length) of source string to the characters of
string
variable in corresponding locations. Length
defaults
to
the length of
string variables, and an error results
If (starting position + length) is
greater than the length of the
source string.
EXAMPLE
10 A$-"THE LAST GOODBYE":
20 PRINT AS
30 MIDS(AJ,6,3>="ONG"
40 PRINT AS
RIGHTS(XS,X)
This returns the right-most X
characlers In
XS
STR${X)
This returns
a
string which is identical to the PRINTed version of XS.
EXAMPLE
AS=STR$(X)
15i