Results 1 to 6 of 6
  1. #1
    artemff is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

    Question How free StringBuffer?

    How free StringBuffer? Not class, only string.

  2. #2
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    I'm not sure I understand what you mean. But if you want the string that the buffer represents use its toString() method.

    Java Code:
    StringBuffer buf = new StringBuffer();
    buf.append("Hello ").append("world");
    
    String greeting = buf.toString();

  3. #3
    artemff is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

    Default

    pbrockway2,
    No I want that content Of StringBuffer become = "";

  4. #4
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

    Default

    Java Code:
    StringBuffer buf = new StringBuffer("whatever");
    // ...
        // either
    buf.setLength(0);
        // or
    buf = new StringBuffer();

  5. #5
    artemff is offline Member
    Join Date
    Dec 2009
    Posts
    41
    Rep Power
    0

    Default

    pbrockway2
    Thanks...

  6. #6
    pbrockway2 is offline Moderator
    Join Date
    Feb 2009
    Location
    New Zealand
    Posts
    4,585
    Rep Power
    12

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2009, 07:03 AM
  2. Replies: 1
    Last Post: 03-03-2009, 06:27 AM
  3. Should I use StringBuffer?
    By GenkiSudo in forum New To Java
    Replies: 7
    Last Post: 09-21-2008, 01:39 PM
  4. StringBuffer
    By Java Tip in forum Java Tip
    Replies: 0
    Last Post: 11-08-2007, 09:33 AM
  5. Help with StringBuffer
    By Marcus in forum AWT / Swing
    Replies: 2
    Last Post: 07-04-2007, 06:50 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •