Anyone know of an online trailing whitespace remover?
I have a JS file (~2000 lines) and want to strip all trailing whitespace. I am using Coda and it has a plugin but it keeps crashing the app. I feel like this is a开发者_运维百科 simple enough thing where there might be an online tool but I can not find one.
Thanks in advance!
Here, I wrote you a little script: http://codepad.org/vZNPOF1a
Just paste in your code where it says, in the text area below, click submit, then click on the output link up above to get the raw output.
Try this:
var removeLineTrailingWhitespace = function(s) {
return (""+s).replace(/(^\s+|\s+$)/mg, '');
};
var str = "foo \n bar \n";
removeLineTrailingWhitespace(str); // => "foo\nbar";
Load it up on Notepad++ and press alt+shift+s
精彩评论