我需要检查变量是否为null或是否具有所有空格或只是空白(“”)。
我有以下内容,但无法正常工作:
var addr;
addr = " ";
if (!addr) {
// pull error
}
如果我执行以下操作,它将起作用:
if (addr) {
}
我需要的是类似C#方法的东西String.IsNullOrWhiteSpace(value)。
那未定义呢?
—
CodeToad
has *any* empty spaces吗 还是你的意思is all empty spaces?