Closed GoogleCodeExporter closed 9 years ago
Simple as, com.google.common.collect.ComparisonChain.compare("SomeString",
"somestring", String.CASE_INSENSITIVE_ORDER);
Original comment by amer...@gmail.com
on 13 Sep 2010 at 12:24
O.o
This indeed solves the problem. However, I don't find it obvious at all,
because I think most people (like me a couple minutes ago) don't even know
String.CASE_INSENSITIVE_ORDER exists, because they never use it.
So perhaps it would be a good idea to add compareToIgnoreCase nonetheless, or
to point out in the API doc that you can do something like this.
Original comment by qforce....@gmail.com
on 13 Sep 2010 at 12:46
... and the second one is shorter:
compare("SomeString", "somestring", String.CASE_INSENSITIVE_ORDER);
compareIgnoreCase("SomeString", "somestring");
Original comment by qforce....@gmail.com
on 13 Sep 2010 at 1:08
Sorry if this sound pedantic (because i'm not, i've learned this the hard way
:p), but every java programmer should know JDK foundation classes such as
java.lang.* and java.util.* and so on, cf.
http://java.sun.com/docs/books/effective/toc.html Item 47 which said that it is
good to take some time to read APIs just to have some vocabulary.
So I don't think adding compareToIgnoreCase is a good thing but as you said
pointing out the tip in doc would be cool.
^.^
Original comment by amer...@gmail.com
on 13 Sep 2010 at 1:12
Agreed :)
Original comment by qforce....@gmail.com
on 13 Sep 2010 at 1:16
String.CASE_INSENSITIVE_ORDER is but one comparator among thousands out there;
it's not for us to try to advertise them.
Original comment by kevinb@google.com
on 13 Sep 2010 at 11:48
This issue has been migrated to GitHub.
It can be found at https://github.com/google/guava/issues/<id>
Original comment by cgdecker@google.com
on 1 Nov 2014 at 4:15
Original comment by cgdecker@google.com
on 3 Nov 2014 at 9:09
Original issue reported on code.google.com by
qforce....@gmail.com
on 13 Sep 2010 at 11:05