This week's book giveaway is in the JDBC forum.
We're giving away four copies of Make it so: Java DB Connections & Transactions and have Marcho Behler on-line!
See this thread for details.
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

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
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!