Difference between revisions of "ASC (statement)"

From QB64 Wiki
Jump to navigation Jump to search
imported>Cyperium
imported>Cyperium
m
Line 24: Line 24:
  
 
  {{Cl|ASC (statement)|ASC}}(a$, 2) = 0
 
  {{Cl|ASC (statement)|ASC}}(a$, 2) = 0
 +
{{Cl|PRINT}} a$
 +
 +
{{Cl|ASC (statement)|ASC}}(a$, 2) = {{Cl|ASC}}("S")
 
  {{Cl|PRINT}} a$
 
  {{Cl|PRINT}} a$
 
{{CodeEnd}}
 
{{CodeEnd}}
Line 30: Line 33:
 
  ABC
 
  ABC
 
  A C
 
  A C
 +
ASC
 
{{OutputEnd}}
 
{{OutputEnd}}
  

Revision as of 00:35, 21 June 2010

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 must be predefined.
  • 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 code% value can be any value from 0 to 255.


Examples

Example:

a$ = "YZC" ASC(a$) = 65 ASC(a$, 2) = 66 PRINT a$ 'ABC ASC(a$, 2) = 0 PRINT a$ ASC(a$, 2) = ASC("S") PRINT a$

ABC A C ASC


See also:

ASC (function), ASCII




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