Appendix C: Macros — Character Classification / Conversion
1275
TI
-
89 / TI
-
92 Plus Developer Guide
Not for Distribution
Beta Version January 26, 2001
isalnum
Declaration:
BYTE
isalnum
(BYTE
c
)
Category(ies):
Character Classification / Conversion
Description:
Return non-zero (true) if the given character is alpha-numeric.
Inputs:
c
— Character to test.
Outputs:
Non-zero if
c
is alpha-numeric, zero otherwise.
Assumptions:
Access_AMS_Global_Variables is defined.
Side Effects:
None
Availability:
AMS 2.00 or above.
TI
-
89 / TI
-
92 Plus
Differences:
None
See Also: isalpha, isdigit
Example:
This example function returns 0 . . . 8 if passed the digits ‘1’ . . . ’9’ and
9 . . . 34 if passed ‘A’ . . . ’Z’ or ‘a’ . . . ’z’; all other characters return -1.
Note that the
isascii
function prevents any of the international alphabetical
characters from being used.
SINT SubChar2I( SINT c )
{ Access_AMS_Global_Variables;
if (isascii(c)) {
c = toupper(c);
if (isalnum(c) && c != '0')
return( ((c < 'A') ? (c - '1') : (c - ('0' + 'A'-'9'))) );
}
return -1;
}