ASC()
Jump to navigation
Jump to search
Description
- Returns the ASCII value of the first character of a string literal or string variable.
Syntax
- ASC(string$)
- ASC("string literal")
Hints
- If the string is an empty string the function will return 0.
- Inverse function: To get the character the ASCII value refers to, use the CHR$() function.
- Only ASCII values between 33 - 255 are printable characters.
- Value 32 represents space. Values 0 - 31 are non-printable control and formatting characters.
Example
' Using a string literal
print asc("A") ' Produces 65
print asc("Able") ' Produces 65
print asc(" ") ' space - Produces 32
print asc("") ' special case of empty string - produces 0
' Using a string variable
valueOfChar$ = "!"
print asc( valueOfChar$ ) ' Produces 33
valueOfChar$ = "!$#0@"
print asc( valueOfChar$ ) ' Produces 33
end
Useful Procedures
' Place a useful function or sub using this keyword here