function IsJsonString(str) {
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
try {
JSON.parse(str);
} catch (e) {
return false;
}
return true;
}
function removeCC(s) {
/* Remove NewLine, Carriage Return and Tab characters from a 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 with regular expression
function removeCC(s){ return s.replace(/[\n\r\t]/g," "); }