Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
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/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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: 18914
    
  40

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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compare Content of StringBuilder