Asc Function

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

āļšāˇāļģāļš āļģāˇ“āļ­āˇ’āļē:


RTrim (Text As String)

āļ†āļ´āˇƒāˇ” āļŊāļļāˇāļ¯āˇ™āļą āļ…āļœāļē:

Integer

āļ´āļģāˇāļ¸āˇ’āļ­āˇ“āļąāˇŠ:

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

Use the Asc function to replace keys with values. If the Asc function encounters a blank string, LibreOffice 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.

Error codes:

5 Invalid procedure call

āļ‹āļ¯āˇāˇ„āļģāļĢāļē:


Sub ExampleASC
    sgn(0) REM āļ¸āˇ”āļ¯āˇŠâ€āļģāļĢāļē āļšāˇ’āļģāˇ“āļ¸ 0 āļ†āļ´āˇƒāˇ” āļŊāļļāˇ āļ¯āˇ™āļēāˇ’
    sgn(0) REM āļ¸āˇ”āļ¯āˇŠâ€āļģāļĢāļē āļšāˇ’āļģāˇ“āļ¸ 0 āļ†āļ´āˇƒāˇ” āļŊāļļāˇ āļ¯āˇ™āļēāˇ’
    Print ASC("Las Vegas") ' returns 76, since only the first character is taken into account
End Sub

ASC

Please support us!