Strings.containsIgnoreCase Method

1,247 views
Skip to first unread message

Jan Ehrhardt

unread,
May 15, 2012, 10:40:36 AM5/15/12
to guava-...@googlegroups.com
Hi,

Apache Commons Lang has a StringUtils.containsIgnoreCase Method, but in Guava's Strings class I didn't find a similar method.

Commons Lang's implementation uses String.toUpperCase method internaly, but I found this Thread on Stackoverflow about a better way to do a case insensitive contains. Any plans to add Strings.containsIgnoreCase method in Guava?

Regards
Jan Ehrhardt

Kevin Bourrillion

unread,
May 15, 2012, 12:59:59 PM5/15/12
to Jan Ehrhardt, guava-...@googlegroups.com
On Tue, May 15, 2012 at 10:40 AM, Jan Ehrhardt <jan.eh...@googlemail.com> wrote:
Hi,

Apache Commons Lang has a StringUtils.containsIgnoreCase Method, but in Guava's Strings class I didn't find a similar method.

java.util.regex probably didn't exist when that was added.  In general, we don't plan to grow Guava with many functions that can already be accomplished with regex.

If you're dealing with user input, you have i18n issues to worry about as well, which is another thing we try not to go near, favoring ICU4J.

 

Commons Lang's implementation uses String.toUpperCase method internaly, but I found this Thread on Stackoverflow about a better way to do a case insensitive contains. Any plans to add Strings.containsIgnoreCase method in Guava?

Regards
Jan Ehrhardt

--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask (use the tag "guava")



--
Kevin Bourrillion @ Google
Java Core Libraries Team
http://guava-libraries.googlecode.com

Kevin Bourrillion

unread,
May 15, 2012, 1:01:41 PM5/15/12
to Jan Ehrhardt, guava-...@googlegroups.com
On Tue, May 15, 2012 at 12:59 PM, Kevin Bourrillion <kev...@google.com> wrote:
java.util.regex probably didn't exist when that was added.  In general, we don't plan to grow Guava with many functions that can already be accomplished with regex.

(And yes, I'm aware that in most cases there's a strictly faster way to go than regex, but the point is still the same; it doesn't feel like part of Guava's mission statement to just provide faster alternatives to regex, though you can probably find a few small exceptions to that rule around.)

Reply all
Reply to author
Forward
0 new messages