Share
 
 

ascii (AutoLISP)

Returns the conversion of the first character of a string into its character code (an integer)

Supported Platforms: Windows, Mac OS, and Web

Signature

(ascii str)
str

Type: String

A single character or text string.

Return Values

Type: Integer

A numeric value in the range of 1-65536.

Release Information

    Releases:

  • AutoCAD R12 and later on Windows
  • AutoCAD 2011 and later on Mac OS

History

    AutoCAD 2021

  • str argument previously accepted an ASCII text string or character, but now accepts a Unicode text string or character.
  • Return value was modified to support Unicode characters and might be different than earlier releases. For example, (ascii "€") previously returned 128, but now returns 8364.
  • LISPSYS system variable controls which AutoLISP engine is used and the behavior of the function.
    • 0 - ASCII character support (legacy behavior)
    • 1 or 2 - Unicode character support
    Note: After the value of the LISPSYS system variable has been changed, AutoCAD must be restarted for the change to take affect.

Examples

(ascii "A")
65

(ascii "a")
97

(ascii "BIG")
66

(ascii "€")
8364

Was this information helpful?