Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java trim function is not working when reading excel data

 
Senthi Maha
Greenhorn
Posts: 5
  • 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
  • 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
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it ... using StringUtils.trim(str) works fine
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic