ASC (statement)

From QB64 Wiki
Revision as of 20:59, 21 June 2010 by imported>Clippy
Jump to navigation Jump to search

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


Syntax

ASC(string_expression$[, position%]) = code%


Description

  • The string expression changed must be predefined. Cannot be an empty string("").
  • Position parameter is optional. If no position is used, the first position is assumed.
  • Position cannot be zero or greater than the string's length(LEN) or an Illegal function error will occur.
  • The ASCII replacement code% value can be any value from 0 to 255.


Examples

Example:

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:

ASC (function), ASCII




Navigation:
Keyword Reference - Alphabetical
Keyword Reference - By Usage
Main Wiki Page