Monday, January 9, 2017

Javascript misterClean string cleaner

function misterClean(x) {
   x = x.replace(/^\s+|\s+$/gm,''); // remove end whitespace
   x = x.replace(/(\r\n|\n|\r)/gm,""); // remove line breaks
   return x;
}

No comments: