Skip to main content
Version: 10.8.0

Function: isASCII()

isASCII(str): boolean

Defined in: src/utils/shortString.ts:18

Test if string contains only ASCII characters (string can be ascii text)

Parameters​

str​

string

The string to test

Returns​

boolean

Returns true if the string contains only ASCII characters, otherwise false

Example​

const result = shortString.isASCII('Hello, world!');
// result = true
const result = shortString.isASCII('Hello, 世界!');
// result = false