GitHub 6248★

Check if a string contains only ASCII characters

JavaScript version

const isAscii = (str) => /^[\x00-\x7F]+$/.test(str);

TypeScript version

const isAscii = (str: string): boolean => /^[\x00-\x7F]+$/.test(str);
Follow me on and to get more useful contents.