Next Previous Contents

44. int

Synopsis

Typecast an object to an integer

Usage

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 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;
    }
Notes

This function is equalent to typecast (s, Integer_Type);

See Also

typecast, double, integer, char, isdigit


Next Previous Contents