I'm guessing you have looked extensively through the reference for a single
function to do this and have simply overlooked the low level functions that
you can use in order to write your own function in 'C' to do this. ;)
You're going to have to loop through the string to the terminating '\0' at
the end
all the while doing a test on each character to see if it's a number or not.
Something like this (or some variant) should work:
Boolean StringIsAllNumbers(char *strptr)
{
char ch;
int i;
Boolean StringIsAllNumbers = true;
for(i=0; i<strlen(strptr); i++)
{
ch = *(strptr++);
if (!TxtCharIsDigit(ch))
StringIsAllNumbers = false;
}
return(StringIsAllNumbers);
}
...although this isn't really a Palm question but more of a 'C' programming
question - aside from the TxtCharIsDigit() :-)
John
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]]On Behalf Of Rene
Sent: Thursday, July 05, 2001 5:35 PM
To: Palm Developer Forum
Subject: Newbie: How to tell if string is numeric.
I have a pointer to a string and I will like to know if the string contains
only numbers. Is there an easy way of doing this?
Thank you.
--
For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/tech/support/forums/
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/