String Comparison; Functions; Asc - Sharp PC-1500 Instruction Manual

Hide thumbs Also See for PC-1500:
Table of Contents

Advertisement

All
and
more
about Sharp PC-1500
at
http://www.PC-1500.info
2) "ABC"
is
entered
in
to
the
area, taking
up
the
fi
rst
three positions.
3)
"DEFGH
I"
is
added to the
character storage
arna.
following
"ABC".
4)
The
LEFTS function
acts
upon
the strin9
"
OE
FGH
I" to
extract
"DE",
whi<:h
then replaces
"DEFGHI"
in
the
area
.
5)
The
assignment
is performed
and the storage area is again cleared.
B.3. String Comparison
Character
strings
may
be compared to determine
..
'lh
ich string is ''greater"
or "less than" the
other.
These
determinations
are
based
on
the
Collating Sequence {given
in
Appendix
C)
\Vhich
is
the order
of all
the
characters
recognized
by the
computer.
It the
strings c<>ntain an
unequal
arnount
of c:haracters, the
shorter
string
is r•padded"
(filled
outl with NULL
characters (ASCII
0).
The operators
which are legitimate for
comparison
of
strings
are:
=
T
rue if
the
ti.•10
strings
are
equal
in
length and contain the same ct1aracters
in
the
same
order
.
<
>
T
rue
if
the
two
strings
differ
in
length, characters,
or
ordering
of
characters.
>
True ifl
the characters of
the first string
are
"greater"
(occur
later
in the ordering)
than
the
characters
in
the second
string.
<
T~uc
if
the
characters
of
the first
string
arc
"less
than" {occur
fi
rst in
the
ordering)
than
the characters
in
the
second
string.
The
format
for stri
ng
comparison is:
character
string
j
OP
ch·aracter
variable
character
str
ing
character
variable
where
OP is
one of
the comparison operators
listed
above.
Examples:
"MARY"> "MARI"
is
Tr
ue
"MARY"
=
"MARY
..
is False
"abc"
<>
"ABC"
is True
"DATA 1"
<
"DATA
2"
is.
T
rue
"?"
<
"
::
"
is
False
Note:
The
form
of AS<
=
BS.
AS>
=
BS cannot
be
used
fo
r
comparing
-character
strings.
Comparison
is
possible however,
in
the forms o
f
(AS< BS)
OR
(A
S~
BS) and
(AS>
BS} OR (AS
=
BS).
C.
FUNCTIONS
C.1.
ASC
There arc
two
f
unctions
used
in
the
coversion of characters to and
from
the
ASCII code. The
function
ASC
converts a single character
into its
ASCII
decimal
code. The
reverse function CH R$
converts
the ASCII decimal code into a
single character
string.
72
Do not sale this PDF
!!!

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents