Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: Testing if a string is an integer?

From: carl:cybercraft at: 9-Dec-2000 4:41

On 09-Dec-00, Philip Bevan wrote:
> 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
That wouldn't work for decimals in the string as "123.7" would be converted to an integer and returned as okay. All I can think of is forall-ing through the string and checking every character, but I'm sure there's a more simpler way in REBOL.