Re: convert hex string to number

2010-03-27 Thread Luc Prefontaine
Use a try catch around parseInt to report bad hex nb formats. At least you'll know if you are feedind odd values to your hex function. Luc Sent from my iPod On 2010-03-27, at 5:18 PM, Glen Rubin wrote: thanks...you rock!! On Mar 27, 4:17 pm, Richard Newman wrote: Is there a function for c

Re: convert hex string to number

2010-03-27 Thread Glen Rubin
thanks...you rock!! On Mar 27, 4:17 pm, Richard Newman wrote: > > Is there a function for converting these strings into normal hex or > > numbers??  I tried num, but it didn't work. > > user=> (read-string "0x44") > 68 > > Safer: > > (defn hex->num [#^String s] >    (binding [*read-eval* false] >

Re: convert hex string to number

2010-03-27 Thread Richard Newman
Is there a function for converting these strings into normal hex or numbers?? I tried num, but it didn't work. user=> (read-string "0x44") 68 Safer: (defn hex->num [#^String s] (binding [*read-eval* false] (let [n (read-string s)] (when (number? n) n You could also us