I have various strings, some like \"45\", some like \"45px\". How how I convert both of these to the number 45?
Expanding on snrobot's answer:
(defn string->integer [s]
(when-let [d (re-find #"-?\d+" s)] (Integer. d)))
This versions returns nil if there are no digits in the input, rather than raising an exception.
My question is whether it's acceptable to abbreviate the name to "str->int", or if things like this should always be fully specified.