read (AutoLISP)

Returns the first list or atom obtained from a string

(read [string])

The read function parses the string representation of any AutoLISP data and returns the first expression in the string, converting it to a corresponding data type.

Arguments

string

A string. The string argument should not contain blanks, except within a list or string.

Return Values

A list or atom. The read function returns its argument converted into the corresponding data type. If no argument is specified, read returns nil.

If the string contains multiple AutoLISP expressions separated by AutoLISP symbol delimiters such as blanks, newline, tabs, or parentheses, only the first expression is returned.

Examples

Command: (read "hello")

HELLO

Command: (read "hello there")

HELLO

Command: (read "\"Hi Y'all\"")

"Hi Y'all"

Command: (read "(a b c)")

(A B C)

Command: (read "(a b c) (d)")

(A B C)

Command: (read "1.2300")

1.23

Command: (read "87")

87

Command: (read "87 3.2")

87