Java’s string trim
routine tests for whitespace using Character.isWhitespace
and so does Clojure’s clojure.string/trim
.
While processing a dataset off the web containing unicode space characters, the trim routine failed to do anything useful. Luckily, a StackOverflow thread suggested using a routine from Google’s guava library. So in Clojure, you can do this:
1 |
(.trimFrom CharMatcher/WHITESPACE %) |
and this will do the job.