cmakepp_lang/types/int
- cmakepp_lang/types/int.cpp_is_int(return str2check)
Determines if a string can lexically be cast to an integer.
For our purposes an integer is any string whose only characters are taken from the numbers 0 through 9, optionally prefixed with a
-
sign. In particular, this means that strings like" 2"
are not recognized as integers by this function (note the space in" 2"
).- Parameters:
return (desc) – The name to use for the variable holding the result.
str2check (str) – The string which may be an integer.
- Returns:
return
will be set toTRUE
ifstr2check
is an integer andFALSE
otherwise.- Return type:
bool
Error Checking
cpp_is_int
will ensure that the caller has provided exactly two arguments. If the caller has provided a different amount of arguments this function will raise an error.