endWithAny static method

bool endWithAny(
  1. String str,
  2. List<String> suffixes
)

给定字符串是否以任何一个字符串结尾
给定字符串和数组为空都返回false

Implementation

static bool endWithAny(String str, List<String> suffixes) {
  if (isEmpty(str) || ListUtil.isEmpty(suffixes)) {
    return false;
  }

  for (var suffix in suffixes) {
    if (str.endsWith(suffix)) {
      return true;
    }
  }
  return false;
}