|
-
Mar 13th, 2002, 01:22 PM
#1
Thread Starter
Frenzied Member
numeric or alpha
Does anyone know how to find if a char is a numeric or an alpha? I know there are functions in a header to do, but I want to know how to do with out that. I remember someone posting that before but for the life of me I cant find it. I recall it could be done by changing it to its bits, then doing something to it. I hope this makes sense...I am high on cold drugs right now
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 13th, 2002, 01:52 PM
#2
Look at how the macros are defined in ctype.h
Because all characters are integers too you can compare them using >, >=, <, <=. And it's easy to find an ASCII table. Just look it up:
#define isdigit(c) ((c) >= '0' && (c) <= '9')
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Mar 13th, 2002, 02:03 PM
#3
Thread Starter
Frenzied Member
MSVS 6, .NET & .NET 2003 Pro
I HATE MSDN with .NET & .NET 2003!!!
Check out my sites:
http://www.filthyhands.com
http://www.techno-coding.com

-
Mar 13th, 2002, 03:06 PM
#4
transcendental analytic
inline bool isdigit(unsigned char c){return c-48<=9;}
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|