Hi Matt,
why can you use to-integer
for example
>> a: "1234567890"
== "1234567890"
>> either error? try [to-integer a] [print "Not an integer"] [print
"Integer"]
Integer
>> a: "1234567890aaaaaa"
== "1234567890aaaaaa"
>> either error? try [to-integer a] [print "Not an integer"] [print
"Integer"]
Not an integer
Cheers Phil
----- Original Message -----
From: "Mat Bettinson" <[EMAIL PROTECTED]>
To: "Giovanni Cardona" <[EMAIL PROTECTED]>
Sent: Friday, December 08, 2000 10:27 PM
Subject: [REBOL] Testing if a string is an integer?
> Folks,
>
> This is a dead basic one and I'm sure I'll feel stupid when someone
> points it out.
>
> Anyway, I have a function which is fed a string. Now I'd like to test
> to see if the string is purely numerical.
>
> I guess parse is the right way of doing it and I've seen examples but
> something basic like
>
> digits: charset [1234567890]
> parse number [digits]
>
> type? and so on appears useless since I KNOW it's a string. I even
> tried using error? try[] to trap an error converting to an integer -
> no luck with that either.
>
> --
> Mat Bettinson - EuroGamer's Gaming Evangelist with a Goatee
> http://www.eurogamer.net | http://www.eurogamer-network.com
>
>
> --
> To unsubscribe from this list, please send an email to
> [EMAIL PROTECTED] with "unsubscribe" in the
> subject, without the quotes.
>
--
To unsubscribe from this list, please send an email to
[EMAIL PROTECTED] with "unsubscribe" in the
subject, without the quotes.