跳到主要内容

removeNonASCII

TS JS Deno

Removes non-printable ASCII characters.

Use a regular expression to remove non-printable ASCII characters.

typescript
const removeNonASCII = (str) => str.replace(/[^\x20-\x7E]/g, "");
typescript
removeNonASCII("äÄçÇéÉêlorem-ipsumöÖÐþúÚ"); // 'lorem-ipsum'