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/int.tm.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 int Context: slangrtl

Synopsis

Typecast an object to an integer

Syntax

int (s)

Description

This function performs a typecast of s from its data type to an object of Integer_Type. If s is a string, it returns returns the ascii value of the first character of the string s. If s is Double_Type, int truncates the number to an integer and returns it.

Example

int can be used to convert single character strings to integers. As an example, the intrinsic function isdigit may be defined as

    define isdigit (s)
    {
      if ((int (s) >= '0') and (int (s) <= '9')) return 1;
      return 0;
    }

This function is equalent to typecast (s, Integer_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.