Though it might not be the best option here, the Clojure reader is
always ready to serve:

user> (type (read-string "123"))
java.lang.Integer
user> (type (read-string "123123123123123"))
java.lang.Long
user> (type (read-string "123123123123123123123123123123123123"))
java.math.BigInteger

Of course, it might also pose a bit of a security threat:

user> (read-string "#=(println \"I OWN YOU NOW!\")")
I OWN YOU NOW!
nil

:)

-Per

On Fri, Mar 26, 2010 at 5:47 AM, Chas Emerick <cemer...@snowtide.com> wrote:
> Glen,
>
> You want (java.math.BigInteger. "2342343...").  java.lang.Integer is limited
> to 2^31-1.
>
> - Chas
>
> On Mar 25, 2010, at 6:40 PM, Glen Rubin wrote:
>
>> I am trying to convert a long string of numbers to a number, but get a
>> java.lang.numberformatexception
>>
>>
>> My long string of numbers has new line characters in it, so I am
>> filtering out the newline characters before converting it back to a
>> string.  Then I try to use Integer. on it but get the above exception.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to