Clojure's clojure.string/trim uses Java's String/trim, but
clojure.string/triml and trimr use Java's Character/isWhitespace to
determine which characters are white space to remove.  CLJ-935 has a
suggested patch to make them all use Character/isWhitespace:

    http://dev.clojure.org/jira/browse/CLJ-935

Character/isWhitespace doesn't consider Unicode code point 0x00A0 a
whitespace character, either, though.  Java's Character/isSpaceChar does,
but neither of those Java methods recognize a set of whitespace characters
that is a superset of the other.  Fun, eh?

I'd recommend writing your own trim that gets rid of exactly what you
want.  Start by copying from the existing triml or the version of trim in
the patch for CLJ-935 and tailoring the condition for whitespace characters
to your heart's desire.

Andy


On Sun, Aug 11, 2013 at 5:54 PM, Tim Visher <tim.vis...@gmail.com> wrote:

> Sorry, I should have been more clear. In the following the space at
> the end of the string is a no break space and the first execution is
> under clojurescript, the second under clojure.
>
>     user> (clojure.string/trim "54 ")
>     "54"
>     bible-plan.mcheyne> :cljs/quit
>     :cljs/quit
>     bible-plan.piggieback-rhino> (clojure.string/trim "54 ")
>     "54 "
>
> So under clojurescript, a no break space is considered whitespace
> (certainly what I would expect!) but on the jvm it is not.
>
> That's the discrepancy I'm talking about. The unicode character NO
> BREAK SPACE (http://www.fileformat.info/info/unicode/char/a0/index.htm)
> seems like it should be considered whitespace.
>
> Of course I know that JVM land String.trim does not do this but I
> would basically consider that a bug.
>
> Further thoughts?
>
> --
>
> In Christ,
>
> Timmy V.
>
> http://blog.twonegatives.com/
> http://five.sentenc.es/ -- Spend less time on mail
>
> --
> --
> 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
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>
>

-- 
-- 
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
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to