zuA8x‖

qJX8t‖Asc Function (BASIC)

8jiwA‖Returns the ASCII (American Standard Code for Information Interchange) value of the first character in a string expression.

FVEx2‖Syntax:


xFKDc‖Asc(string) As Long

bBBqF‖Return type:

Long

WADQ4‖Parameters:

DZtGt‖string: Any valid string expression. Only the first character in the string is relevant.

CF7UG‖Use the Asc function to replace keys with values. If the Asc function encounters a blank string, LibreOfficeDev Basic reports a run-time error. In addition to 7 bit ASCII characters (Codes 0-127), the ASCII function can also detect non-printable key codes in ASCII code. This function can also handle 16 bit unicode characters.

SEjHR‖Error codes:

5 Invalid procedure call

EFSA4‖Example:


Sub ExampleASC
ts3eo‖    Print ASC("A") ' returns 65
SQA9e‖    Print ASC(string:="Z") ' returns 90
Bf7Gw‖    Print ASC("Las Vegas") ' returns 76, since only the first character is taken into account
End Sub