wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Cast from StringBuffer to String Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Cast from StringBuffer to String" Watch "Cast from StringBuffer to String" New topic

Cast from StringBuffer to String

Reggie McDougal
Ranch Hand

Joined: Sep 27, 2004
Posts: 69
How do I cast a stringBuffer to a string?

Is the is right way to go?


You can never drink too much
Andrew Eccleston
Ranch Hand

Joined: Jul 07, 2004
Posts: 140
You will want to use the append() method of StringBuffer when adding to string data in a StringBuffer object. Then, call StringBuffer's toString() method to return the entire contents as a string value.

To be honest, the biggest thing you can do to help yourself out, is to familiarize yourself with the api documentation at http://java.sun.com/j2se/1.5.0/docs/api/. The StringBuffer class is in the java.lang package (on the left side).


[ December 02, 2004: Message edited by: Andrew Eccleston ]
[ December 02, 2004: Message edited by: Andrew Eccleston ]

The statement below is true.<br />-------------------------------<br />The statement above is false.
wood burning stoves
subject: Cast from StringBuffer to String
Similar Threads
String explanation
String manipulation
Changing the WORLD by writing CODE
Stack Help...
string equals question