Remove control characters from a stringTag(s): Language
function removeNL(s) { /* ** Remove NewLine, CarriageReturn and Tab characters from a String ** s string to be processed ** returns new string */ r = ""; for (i=0; i < s.length; i++) { if (s.charAt(i) != '\n' && s.charAt(i) != '\r' && s.charAt(i) != '\t') { r += s.charAt(i); } } return r; }
Same thing but using a regular expression
function removeNL(s){ return s.replace(/[\n\r\t]/g,); }
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com