RosettaCodeData/Task/Strip-control-codes-and-extended-characters-from-a-string/JavaScript/strip-control-codes-and-extended-characters-from-a-string-1.js
2023-07-01 13:44:08 -04:00

14 lines
270 B
JavaScript

(function (strTest) {
// s -> s
function strip(s) {
return s.split('').filter(function (x) {
var n = x.charCodeAt(0);
return 31 < n && 127 > n;
}).join('');
}
return strip(strTest);
})("\ba\x00b\n\rc\fd\xc3");