-
Notifications
You must be signed in to change notification settings - Fork 0
removeNonePrintableCharacters
Mike Byrne edited this page Mar 17, 2023
·
1 revision
Introduced 3.1.0
Removes or replaces non printable characters from a string, whilst leaving ASCII and non ASCII characters alone.
- nothing
- str - required - string to remove non printable characters from
- replaceMode - optional - boolean - defaults to false - switch to replace mode from remove mode
- string minus non printable characters
Using default input from www.soscisurvey.de/tools/view-chars:
let str = removeNonePrintableCharacters(`See what's hidden in your string… or behind`); // 'Seewhat's hidden in your string… or behind'
With replaceMode
set to true
:
let str = removeNonePrintableCharacters(`See what's hidden in your string… or behind`, true); // 'See what's hidden in your string…or behind'
In comparison with removeNoneASCIICharacters:
Leaves accented characters and emoji:
let str = removeNonePrintableCharacters(`Hernán Cortés de Monroy y Pizarro Altamirano 🇪🇸`); // `Hernán Cortés de Monroy y Pizarro Altamirano 🇪🇸`
Leaves characters from none Latin languages:
let str = removeNonePrintableCharacters(`Είναι πλέον κοινά παραδεκτό ότι ένας αναγνώστης αποσπάται από το περιεχόμενο που διαβάζει`); // `Είναι πλέον κοινά παραδεκτό ότι ένας αναγνώστης αποσπάται από το περιεχόμενο που διαβάζει`