Easy way to determine number from a string?

Discuss PocketC for Palm OS (including Desktop Edition)

Postby Velvis on Sun Jan 28, 2001 4:25 pm

I have user input that is placed into a string variable. I'd like to be able to know if the value stored in the variable is a number or a text character/string.

Is there a way to do this?

Thanks
Velvis
 
Posts: 226
Joined: Mon Dec 11, 2000 2:32 am

Postby Moonlite on Sun Jan 28, 2001 5:17 pm

I think this might work, but I'm not sure.

int number
string usersaid
number = usersaid
if(number == 0){
//do something with usersaid
} else{
//do something with number
}

Of course, this will only work if you know the number will not be 0. It really depends. Hope this will help you!
Moonlite
 
Posts: 9
Joined: Sun Jan 21, 2001 2:11 pm


Return to PocketC for Palm OS

Who is online

Users browsing this forum: No registered users and 2 guests

cron