js判断是否是空字符串,空格或者中文空格也算空字符串
function isNotEmptyStr(s) {if (typeof s == 'string' && s.length > 0) {// Trim the string to remove spaces and Chinese spacesconst trimmedStr = s.replace(/[\s\u3000]/g, '');if(trimmedStr.length > 0)return true;}return false
}
此函数首先检查输入是否为字符串。然后使用正则表达式从字符串中删除所有空格和中文空格,并检查结果字符串长度。如果修剪后字符串长度>0,则返回true;否则,返回false。