QB64.com

QB64 is a modern extended BASIC programming language that retains QBasic/QuickBASIC 4.5 compatibility and compiles native binaries for Windows, Linux, and macOS.

The ASC (statement) statement allows a QB64 program to change a character at any position of a STRING variable.

Syntax

ASC (statement)(stringExpression$[, position%]) = code%

Description

Example(s)

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

See Also