It's not a secret anymore!
The moose likes Beginning Java and the fly likes Comparing Strings Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Comparing Strings" Watch "Comparing Strings" New topic

Comparing Strings

Daniel Roman

Joined: Jan 24, 2004
Posts: 4
I want to write a method that should return true if it refers to a String object that is the same . Otherwise, the method should return false.
Any suggestions ??
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522

if you want to compare regardless to the string case (upper or lower) then use s1.equalsIgnoreCase(s2)

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
I agree. Here's the link:
subject: Comparing Strings
It's not a secret anymore!