About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/_slang_guess_type.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 _slang_guess_type Context: slangrtl

Synopsis

Guess the data type that a string represents.

Syntax

DataType_Type _slang_guess_type (String_Type s)

Description

This function tries to determine whether its argument s represents an integer (short, int, long), floating point (float, double), or a complex number. If it appears to be none of these, then a string is assumed. It returns one of the following values depending on the format of the string s:

    Short_Type     :  short integer           (e.g., "2h")
    UShort_Type    :  unsigned short integer  (e.g., "2hu")
    Integer_Type   :  integer                 (e.g., "2")
    UInteger_Type  :  unsigned integer        (e.g., "2")
    Long_Type      :  long integer            (e.g., "2l")
    ULong_Type     :  unsigned long integer   (e.g., "2l")
    Float_Type     :  float                   (e.g., "2.0f")
    Double_Type    :  double                  (e.g., "2.0")
    Complex_Type   :  imaginary               (e.g., "2i")
    String_Type    :  Anything else.          (e.g., "2foo")

For example, _slang_guess_type("1e2") returns Double_Type but _slang_guess_type("e12") returns String_Type.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.