|
IDL Reference Guide: Procedures and Functions |
|
The IDL_VALIDNAME function determines whether a string may be used as a valid IDL variable name or structure tag name. Optionally, the routine can convert non-valid characters into underscores, returning a valid name string.
Result = IDL_VALIDNAME(String [, /CONVERT_ALL] [, /CONVERT_SPACES])
Returns the input string or strings, optionally converting all spaces or non-alphanumeric characters to underscores. If an input string cannot be used as a valid variable or structure tag name, a null string is returned.
A scalar string or string array or representing the IDL variable or structure tag names to be checked.
If this keyword is set, then each element of String is converted into a valid IDL variable name using the following rules:
| Tip The CONVERT_ALL keyword guarantees that a valid variable name is returned. It is useful in converting user-supplied strings into valid IDL variable names. |
If this keyword is set, then all spaces within each element of String are converted to underscores. If an element of String contains any other non-alphanumeric characters, then a null string is returned, indicating that the string cannot be used as a valid variable name.
| Note CONVERT_SPACES behaves the same as CREATE_STRUCT when checking structure tag names. |
The following table provides IDL_VALIDNAME examples and their results.
IDL Online Help (March 06, 2007)