Futurebasic/Language/Reference/asc

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Asc[edit | edit source]

Function[edit | edit source]

✔ Appearance ✔ Standard ✔ Console

Syntax[edit | edit source]

ASCIIcode% = asc( string$ )
ASCIIcode% = asc( container$$ )

Revised[edit | edit source]

July 28, 2000 (Release 3)

Description[edit | edit source]

Returns the ASCII character code for the first character in string$ or container$$. (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).) If string$ (or container$$) contains no characters, then asc( string$ ) returns zero.

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."

Notes[edit | edit source]

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

ASCIIcode% = _"G"

The above code executes much faster than ASCIIcode% = asc( "G" ).

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

ASCIIcode% = stringVar$[n]

See Also[edit | edit source]

chr$; Appendix F: ASCII Character Codes

Language Reference