Skip to content

Instantly share code, notes, and snippets.

@beyoung
Created January 26, 2015 05:32
Show Gist options
  • Save beyoung/b824a761a98f87189bb6 to your computer and use it in GitHub Desktop.
Save beyoung/b824a761a98f87189bb6 to your computer and use it in GitHub Desktop.
// clear stringbuffer
/*
** first method
*/
StringBuffer sb = new StringBuffer("HelloWorld");
// after many iterations and manipulations
sb.setLength(0);
/*
** second method
*/
sb.delete(0, buf.length());
/*
** third method
*/
sb=new StringBuffer()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment