isAllEmpty static method

bool isAllEmpty(
  1. List<String>? strs
)

指定字符串数组中的元素,是否全部为空字符串。

如果指定的字符串数组的长度为 0,或者所有元素都是空字符串,则返回 true。


例:

```dart StrUtil.isAllEmpty() // true} StrUtil.isAllEmpty("", null) // true} StrUtil.isAllEmpty("123", "") // false} StrUtil.isAllEmpty("123", "abc") // false} StrUtil.isAllEmpty(" ", "\t", "\n") // false} ```

注意:该方法与 {@link #hasEmpty(CharSequence...)} 的区别在于:

```dart [hasEmpty] 等价于 {[isEmpty] || [isEmpty] || ...} [isAllEmpty] 等价于 {[isEmpty] && [isEmpty] && ...} ```

Implementation

static bool isAllEmpty(List<String>? strs) {
  if (ListUtil.isEmpty(strs)) {
    return true;
  }

  for (var str in strs!) {
    if (isNotEmpty(str)) {
      return false;
    }
  }
  return true;
}