The only values we
want
to appear
in
W$
are the numbers to the right of the
sign value in both T$ and
Q$.
Here again the string functions
will
aid
us.
The
LEFT$,
MID$, and
RIGHT$
functions allow the programmer to select any character
or group of characters from
within
a given string. For our problem,
we
want
just
the characters to the right of the first character, the first character being the sign
value (either blank
or"
-'').
For instance, T$=RIGHT$(T$,LEN
(T$)
-1)
would result
in:
Before: After:
T$
ItJI1I2131415\
- T$
11121314151
Since the first
digit
desired
is
in the second position of the string, by telling
the
PET
to
use
only the values starting in position
#2
and moving to the right.
it
will
drop the sign character. Therefore, to save programming steps and memory
space, we
can
program the
PET
to concatenate T$ and
Q$
and drop the leading
blank ail in one statement:
W$=RIGHT$(T$.LEN(T$)-l)+RIGHT$(O$,LEN(O$)-l)
"'Drop lea'd:ng blank J , ...... Drop
le~ng
blank
.......
of
T$
of
0$
Concatenate
T$ and
0$
Our example program, amended to eliminate the sign digits, appears
as
follows:
1(1
T=
12:345
T =ltJ123451
20
Q=67890
o =ltJ6789ol
:3(1
T$=STF.:$(T)
T$
-/tJI1/21314151
50
W$=RIGHT$(T$,LEN(T$)-1)+RIGHT$(LEN(Q$)-1)
W$
= RIGHT$(T$.6-1)
+RIGHT$(0$.6-1)
W$
= RIGHT$(T$.5) +RIGHT$(0$.5)
W$
= T$
/1121314151
+0$
16171819101
W$
=111213141516171819101
F.:Ut·j
~'J$=
123456789(1
784