Remote-processing BASIC 52 Bedienungsanleitung Seite 22

  • Herunterladen
  • Zu meinen Handbüchern hinzufügen
  • Drucken
  • Seite
    / 163
  • Inhaltsverzeichnis
  • LESEZEICHEN
  • Bewertet. / 5. Basierend auf Kundenbewertungen
Seitenansicht 21
RPBASIC-52 PROGRAMMING GUIDE
2-3
ASC
Syntax: ASC(ASCII character)
ASC(string,position expr)
Where: ASCII character = number from 0 to 255
string = any valid string variable
position expr = 1 to length of string
Function: Returns or sets the integer value of an ASCII character or the character in string at position expr.
Mode: Command, run
Use: PRINT ASC(C)
ASC($(3),1)=48H
C = ASC($(0),P)
Cards: All
DESCRIPTION
The ASC operator either sets or returns the value of an ASCII character. Use ASC to evaluate, change or
manipulate individual characters in a string.
The first syntax returns the value of an ASCII character. If ASCII character were the letter 'B', a 66 is
returned. Basic converts any lower case variable symbols to upper case. Lower case characters must be put
into a string to be evaluated.
The second syntax, shown under Use, sets a character in a string to a specific value. This is useful when you
want to manipulate individual characters in a string.
The third syntax returns a value in string at position expr. This form is useful when you want to evaluate
individual characters in a string, such as generating a checksum.
The STR command, unique to RPBA SIC-52, manipulates entire strings.
RELATED
CHR, STR, STRING
ERROR
SYNTAX Attempt to convert an improper value.
EXAMPLE
The following example prints ASCII values from the string $(0). The first 3 characters are modified at lines
70 to 90. The result is then printed.
10 STRING 200,20
20 $(0)="abc123"
30 FOR N=1 TO 6
40 PRINT ASC($(0),N),
50 NEXT
60 PRINT
70 FOR N=1 TO 3
80 ASC($(0),N)=65+N
90 NEXT
100 PRINT $(0)
READY
>RUN
97 98 99 49 50 51
BCD123
Seitenansicht 21
1 2 ... 17 18 19 20 21 22 23 24 25 26 27 ... 162 163

Kommentare zu diesen Handbüchern

Keine Kommentare