Maybe I'm just being lazy though.
Programmer Pro-tip #127: Language depending, Trim() has a parameter override allowing you to trim more than just spaces.
Javascript doesn't have this but you can easily write a method to replace the default trim method so that you can do this.
Programmer Pro-tip #127: Language depending, Trim() has a parameter override allowing you to trim more than just spaces.
Javascript doesn't have this but you can easily write a method to replace the default trim method so that you can do this.
In my worst situation a .trim would haven trimmed all whitespace, but it wasn't used since there was a character limit. Too bad users copied from emails including a few dozen newlines at the end.
Wasn't hard to fix, but hard to find.
In my worst situation a .trim would haven trimmed all whitespace, but it wasn't used since there was a character limit. Too bad users copied from emails including a few dozen newlines at the end.
Wasn't hard to fix, but hard to find.
Isn't there an encode that automagically strips all that nonsense?
Isn't there an encode that automagically strips all that nonsense?
A trim() is usually a good thing when handling user input. I spent too many hours of my life fixing problems caused by not using it.