[AIT logo]

Institut für Astronomie und Astrophysik

Abteilung Astronomie

Sand 1, D-72076 Tübingen, Germany
[Uni logo]


IDL_VALIDNAME() Source code in idl_validname.pro

IDL_VALIDNAME()

Name
  IDL_VALIDNAME()
Purpose
   Modify a string if necessary, so that it can used as a IDL variable name.
Explanation
   Duplicates the intrinsic V6.0 function IDL_VALIDNAME() with the
       CONVERT_ALL keyword, for  pre-V6.0 compatibility
   IDL_VALIDNAME performs the following:
   (1) All non-alphanumeric characters (except '_' and '$') are converted
       to underscores
   (2) If the first character is not alphabetic or a '_' or a '!' then an
       underscore is preprended to the string
   (3) If the string is an IDL reserved word (e.g. 'endif') then an
       underscore is preprended to the string.
Calling Sequence
    result = IDL_VALIDNAME( str, /Convert_all )
Input Parameters
      str - Scalar string to be converted to a valid variable name.
Output Parameters
      result - the input string modified, if necessary, according to the
           3 rules above, so that it can be used as a valid IDL variable.
Optional Input Keywords
    /CONVERT_ALL -- Does nothing, but ensures compatibility with V6.0
          intrinsic call IDL_VALIDNAME(/CONVERT_ALL)
Procedures Used
     None.
Example
      (1) IDL> print,idl_validname('switch',/convert_all)
          _switch           ;IDL reserved keyword
      (2) IDL> print,idl_validname('2mass',/convert_all)
          _2mass            ;1st character must be alphabetic
      (3) IDL> print,idl_validname('date$',/convert_all)
          date$             ;no change, input string already valid
Revision History
         Written by W. Landsman  SSAI  October 2003

Last modified by pro2html on 2003 October 16 at 03:59 UTC

[Home Page] [Software, Documentation] [IDL Documentation] [Quick Reference] [Feedback]

Jörn Wilms (wilms@astro.uni-tuebingen.de)
Updated automatically