Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to trim a StringBuffer??!!

 
Bharat Macwana
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers!!

is this the best way to trim a StringBuffer?

 
Maneesh Godbole
Saloon Keeper
Posts: 11021
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In your code, you are trimming the string and not the buffer.
 
Campbell Ritchie
Sheriff
Posts: 48363
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You mean s.trim(), surely?

You should usually use StringBuilder instead, and there appears to be a suitable method if you look through its documentation.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic