File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java trim function is not working when reading excel data

 
Senthi Maha
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From java,I am trying to read the values from excel,excel values have white-spaces in it. I was not able to trim it. java trim function is not working in it. Please help me.
 
Ravishanker kumar
Ranch Hand
Posts: 53
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you please provide exact code that you are using. There might me some misunderstanding...
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
String.trim() only removes white-space at the begin and end. Not in the middle and remember that it returns a new String object. The value of the original String is not altered.
 
Senthi Maha
Greenhorn
Posts: 5
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it ... using StringUtils.trim(str) works fine
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic