Reputation:
I have a string
"Check Box "
The string contain the extra spaces at the end. I want to remove those extra spaces as i am going to explode the middle spaces using '_'.
The problem is when i use explode function it also converts the end spaces to '_'
How to deal with that????
Upvotes: 2
Views: 461
Reputation: 22323
Use trim
before replace .
var str="Check Box "
str = $.trim(str);
//Your replce logic goes
Upvotes: 1