FutureBasic Logo

<<    Index    >> FutureBasic

asc   function



Syntax
charCode = asc( PascalString )
charCode = asc( container$$ )

Description
Returns the ASCII character code for the first character in PascalString or container$$. If PascalString (or container$$) has zero length, then asc(PascalString) returns zero.
A character code is a numeric value in the range of 0 through 255 that represents a specific character in the American Standard Code for Information Interchange (ASCII). The ASCII character codes between 32 and 127 represent standard characters which generally remain the same from one font family to another. Codes greater than 127 represent different sets of characters depending on the font. Codes below 32 usually represent non-printing "characters."

Note
If the string is a single-character literal, such as "G", consider using the underscore-literal syntax instead, as in this example:

charCode = _"G"

The above code executes much faster than charCode = asc( "G" )

You can use the following syntax to return the ASCII code of the n-1-th character in a string variable:

charCode = stringVar$[n]

See also
chr$; Appendix F - ASCII Character Codes