forked from QB64-Phoenix-Edition/QB64pe
-
Notifications
You must be signed in to change notification settings - Fork 0
ASC (statement)
Samuel Gomes edited this page Nov 8, 2022
·
1 revision
The ASC (statement) statement allows a QB64 program to change a character at any position of a STRING variable.
ASC (statement)(stringExpression$[, position%]) = code%
- The stringExpression$ variable's value must have been previously defined and cannot be an empty string ("").
- position% is optional. If no position is used, the leftmost character at position 1 is assumed.
- position% cannot be zero or greater than the string's LEN or an ERROR Codes will occur.
- The ASCII replacement code% value can be any INTEGER value from 0 to 255.
- Some ASCII control characters will not PRINT a character or may format the SCREEN. _PRINTSTRING can print them graphically.
Demonstrates how to change existing text characters one letter at a time.
a$ = "YZC"
ASC(a$) = 65 ' CHR$(65) = "A"
ASC(a$, 2) = 66 ' CHR$(66) = "B"
PRINT a$ 'ABC
ASC(a$, 2) = 0 ' CHR$(0) = " "
PRINT a$
ASC(a$, 2) = ASC("S") ' get code value from ASC function
PRINT a$
ABC
A C
ASC
- ASC (function)
- MID$ (statement)
- _PRINTSTRING
- INKEY$, ASCII