Next Previous Contents

44. int


Typecast an object to an integer


int (s)


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.


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);

See Also

typecast, double, integer, char, isdigit

Next Previous Contents