Futurebasic/Language/Reference/asc

Function

edit

✔ Appearance ✔ Standard ✔ Console

Syntax

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

Revised

edit

July 28, 2000 (Release 3)

Description

edit

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

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

chr$; Appendix F: ASCII Character Codes

Language Reference