Rockwell Automation 1771-DB BASIC MODULE User Manual
Page 125
Advertising
![background image](/manuals/579953/125/background.png)
Chapter
Expressions, Variables and Operators
9
9 -15
The numbers printed in this example represent the ASCII characters A
through L.
>NEW
>1 REM EXAMPLE PROGRAM
>5 STRING 1000,40
>10 $(1)=“ABCDEFGHIKJL”
>20 FOR X = 1 TO 12
>30 PRINT ASC($(1),X),
>40 NEXT X
>50 END
READY
>RUN
65 66 67 68 69 70 71 72 73 75 74 76
READY
>
You can also use the ASC operator to change individual characters in a
defined string. In general, the ASC operator lets you manipulate individual
characters in a string.
>NEW
>1 REM EXAMPLE PROGRAM
>5 STRING 1000,40
>10 $(1) = “ABCDEFGHIJKL”
>20 PRINT $(1)
>30 ASC($(1),1) = 75 : REM DECIMAL EQUIVALENT OF K
>40 PRINT $(1)
>50 ASC($(1),2) = ASC($(1),3)
>60 PRINT $(1)
READY
>RUN
ABCDEFGHIJKL
KBCDEFGHIJKL
KCCDEFGHIJKL
READY
>
Advertising