-
Notifications
You must be signed in to change notification settings - Fork 0
removeNoneASCIICharacters
Mike Byrne edited this page Mar 14, 2023
·
1 revision
Introduced 3.1.0
Removes non ASCII characters from a string.
Because it removes all non ASCII characters, it maybe removing more than you intend. You may instead want to remove all non printable characters - replaceNonPrintableCharacters
- nothing
- str - required - string to remove non ASCII characters from
- string minus non ASCII characters
let str = removeNoneASCIICharacters(` ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿƒΑΒΓΔΕΖΗΘΙΚΛΜΝΞΟΠΡΣΤΥΦΧΨΩαβγδεζηθικλμνξοπρςστυφχψωϑϒϖ•…′″‾⁄℘ℑℜ™ℵ←↑→↓↔↵⇐⇑⇒⇓⇔∀∂∃∅∇∈∉∋∏∑−∗√∝∞∠∧∨∩∪∫∴∼≅≈≠≡≤≥⊂⊃⊄⊆⊇⊕⊗⊥⋅⌈⌉⌊⌋〈〉◊♠♣♥♦"&<>ŒœŠšŸˆ˜ –—‘’‚“”„†‡‰‹›€`); // '"&<>'
Using default input from www.soscisurvey.de/tools/view-chars:
let str = removeNoneASCIICharacters(`See what's hidden in your string… or behind`); // Seewhat's hidden in your string or behind
Removes accented characters but not emoji:
let str = removeNoneASCIICharacters(`Hernán Cortés de Monroy y Pizarro Altamirano 🇪🇸`); // `Hernn Corts de Monroy y Pizarro Altamirano 🇪🇸`
Will remove characters from none Latin languages:
let str = removeNoneASCIICharacters(`Είναι πλέον κοινά παραδεκτό ότι ένας αναγνώστης αποσπάται από το περιεχόμενο που διαβάζει`); // ``