Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Easy way to Combine EqualsIgnoreCase and Contains

843789Jan 13 2010 — edited Jan 13 2010
I seem to be having a brain fart or something. Is there an easy way to combine the equalsignorecase and contains methods for string?

if(docUser.equalsIgnoreCase(user))
	        			{
	        			//doit
	        			}
Edit: I assume I can convert both to lower case but any other way?
if(docUser.toLowerCase().contains(user.toLowerCase()))
	        			{
	        			//doit
	        			}
Edited by: sarcasteak on Jan 13, 2010 8:54 AM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 10 2010
Added on Jan 13 2010
3 comments
313 views