• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cast from StringBuffer to String

 
Reggie McDougal
Ranch Hand
Posts: 69
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do I cast a stringBuffer to a string?




Is the is right way to go?

Matt
 
Andrew Eccleston
Ranch Hand
Posts: 140
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).

andrew

[ December 02, 2004: Message edited by: Andrew Eccleston ]
[ December 02, 2004: Message edited by: Andrew Eccleston ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic