Skip to content

@pmun/utils / isEmptyString

Function: isEmptyString()

ts
function isEmptyString(str): boolean;

检查字符串是否为空或只包含空白字符

Parameters

str

string

要检查的字符串

Returns

boolean

如果字符串为空或只包含空白字符,则返回 true

Example

ts
isEmptyString('') // true
isEmptyString('  \t\n  ') // true
isEmptyString('hello') // false
isEmptyString(' hello ') // false