This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

numbers in var

Old posts that have not been replied to for several years.
Locked
User avatar
Papillon
Owner
Posts: 724
Joined: Fri Feb 15, 2002 8:00 pm
Location: *.no

Post by Papillon »

I can't seem to figure out how to check if a string consist of just numbers or if there is any other chars in it.. I've tried "string is" but it didn't seem to work :/ Any ideas?

Elen sila lúmenn' omentielvo
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

well, 'string is digit $var' will work if you're using a newer tcl version. if you got old tcl version, then you can use something like 'catch {incr var}', which will return 0 if its an integer, and 1 if not (note that the variable is declared with no $ in the incr)
Locked