This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Compare Content of StringBuilder Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compare Content of StringBuilder" Watch "Compare Content of StringBuilder" New topic
Author

Compare Content of StringBuilder

Nestor Alduey
Greenhorn

Joined: Jul 30, 2006
Posts: 26
Hi All,

How can I compare if are equals in caracters, like I compare strings, because when I use equals method it compares only the object and not the caracters.

How can I do in this case?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 20154
    
  46

I believe the way to do this is to use toString() to get the strings, and compare them.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
 
subject: Compare Content of StringBuilder
 
It's not a secret anymore!