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 use parseInt, which will be faster, so long as you can
guarantee the format:
(defn hex->num [#^String s]
(Integer/parseInt (.substring s 2) 16))
--
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.