Remove control character from a string





9
Date Submitted Thu. Aug. 10th, 2006 2:35 AM
Revision 1 of 1
Syntax Master sundaramkumar
Tags JavaScript
Comments 0 comments
Remove control character from a string


function removeNL(s) {
/*
** NewLine, CarriageReturn and Tab characters from a String will be removed
** and will return the 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;
}
 

Comments

There are currently no comments for this snippet.

Voting