Commodore VIC-20 User Manual page 391

Hide thumbs Also See for VIC-20:
Table of Contents

Advertisement

Appendix H: BASIC Functions
377
POS
POS returns the column position of the cursor.
Format:·
POS(data)
data is a dummy function; it is not used and therefore can have any
value.
POS returns the current cursor position. If no cursor is displayed, the
current character position within a program line or string variable is
returned. Character positions begin at 0 for the leftmost character.
Recall that program logic processes 80-character lines even though the
VIC 20 computer has a 22-character display. If program logic in such a
computer is processing a character in the second half of the line, the POS
function will return a value between the beginning and the end of the line (in
other words, 23 to 44).
By concatenation, string variables with up to 255 characters may be
generated. If program logic is processing a long string, then the POS
function will return the character position currently being processed. Under
these circumstances the POS function will return a value ranging between 0
and 255.
Example:
?POS(l)
At the beginning of a line, returns 0
?"AJlCABC"iPOS(l)
With a previous POS value of 0, displays a POS value of 6
RIGHT$
RIGHT$ returns the rightmost characters in a string.
Format:
RIGHT$(arg$,byte)
byte identifies the number of rightmost characters that are extracted
from the string specified by arg$.
Example:
RIGHT$(ARG,2)
Displays RO

Advertisement

Table of Contents
loading

Table of Contents