Guess the data type that a string represents.
DataType_Type _slang_guess_type (String_Type s)
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.
- slangrtl
-
_print_stack,
_typeof,
atof,
char,
double,
int,
integer,
isdigit,
set_float_format,
sprintf,
sscanf,
string,
typecast,
typeof
|