is-string-ascii-es/printable.ts
2024-05-04 15:26:20 +08:00

10 lines
357 B
TypeScript

const regexpASCIIPrintable = /^[\x20-\x7E]*$/;
/**
* Determine whether the string is ASCII printable characters.
* @param {string} item Item that need to determine.
* @returns {boolean} Determine result.
*/
export function isStringASCIIPrintable(item: string): boolean {
return regexpASCIIPrintable.test(item);
}
export default isStringASCIIPrintable;