stringAny function

bool stringAny(
  1. bool anyFunction(
    1. String sub
    ),
  2. String s
)

Check if any characters meet criteria

Implementation

bool stringAny(bool Function(String sub) anyFunction, String s) {
  if (s.isEmpty) {
    return false;
  }
  for (int i in s.codeUnits) {
    if (anyFunction(String.fromCharCode(i))) {
      return true;
    }
  }
  return false;
}