snvalid
 
 
 

Checks the symbol table name for valid characters

(snvalid sym_name [flag]) 

The snvalid function inspects the system variable EXTNAMES to determine the rules to enforce for the active drawing. If EXTNAMES is 0, snvalid validates using the symbol name rules in effect prior to AutoCAD 2000. If EXTNAMES is 1 (the default value), snvalid validates using the rules for extended symbol names introduced with AutoCAD 2000. The following are not allowed in symbol names, regardless of the setting of EXTNAMES:

AutoLISP does not enforce restrictions on the length of symbol table names if EXTNAMES is 1.

Arguments

sym_name

A string that specifies a symbol table name.

flag

An integer that specifies whether the vertical bar character is allowed within sym_name. The flag argument can be one of the following:

0 Do not allow vertical bar characters anywhere in sym_name. This is the default.

1 Allow vertical bar characters in sym_name, as long as they are not the first or last characters in the name.

Return Values

T, if sym_name is a valid symbol table name; otherwise nil.

If EXTNAMES is 1, all characters are allowed except control and graphic characters and the following:

Characters disallowed in symbol table names

< >

less-than and greater-than symbol

/ \

forward slash and backslash

"

quotation mark

:

colon

?

question mark

*

asterisk

|

vertical bar

,

comma

=

equal sign

`

backquote

;

semicolon (ASCII 59)

A symbol table name may contain spaces.

If EXTNAMES is 0, symbol table names can consist of uppercase and lowercase alphabetic letters (e.g., A-Z), numeric digits (e.g., 0-9), and the dollar sign ($), underscore (_), and hyphen (-) characters.

Examples

The following examples assume EXTNAMES is set to 1:

Command: (snvalid "hocus-pocus")

T

Command: (snvalid "hocus pocus")

T

Command: (snvalid "hocus%pocus")

T

The following examples assume EXTNAMES is set to 0:

Command: (snvalid "hocus-pocus")

T

Command: (snvalid "hocus pocus")

nil

Command: (snvalid "hocus%pocus")

nil

The following example includes a vertical bar in the symbol table name:

Command: (snvalid "hocus|pocus")

nil

By default, the vertical bar character is considered invalid in all symbol table names.

In the following example, the flag argument is set to 1, so snvalid considers the vertical bar character to be valid in sym_name, as long as it is not the first or last character in the name:

Command: (snvalid "hocus|pocus" 1)

T