> using TxtCharIsDigit() on each individual
> would probably slow down the application.
Did you *try* it? Before optimizing, try measuring the effect operations have
on your application. In this case, since TxtCharIsDigit is merely a macro that
performs a bitwise "and" and a test against zero, I seriously doubt that your
application's performance will be impacted.
You can check the whole string with something like the following (untested)
code:
str = FldGetTextPtr (fld);
while (*str)
{
WChar curChar;
str += TxtGetNextChar(str, 0, &curChar);
if (!TxtCharIsDigit(curChar))
{
FrmAlert(AlarmInvalidAlert);
return(false);
}
}
OK, so TxtGetNextChar is *not* a macro. But I still doubt that the time it
takes will be noticable.
-- Keith Rollin
-- Palm OS Emulator engineer
Please respond to "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent by: "Nicolas Zeitlin" <[EMAIL PROTECTED]>
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
cc: (Keith Rollin/US/PALM)
Subject: Numeric strings
I need to constantly check wether a a string is numeric. The string might be
as much as 20 characters long, and using TxtCharIsDigit() on each individual
would probably slow down the application. I'd like a function, or a
combination of them, that would check wether a whole string is numeric.
Thanks a lot,
Nicolas Zeitlin
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/