checkMinDigit static method

bool checkMinDigit(
  1. String string,
  2. int minDigit
)

Implementation

static bool checkMinDigit(String string, int minDigit) {
  int counter = 0;
  for (int i = 0; i < string.length; i++) {
    if (string.codeUnitAt(i) >= 0 && string.codeUnitAt(i) <= 9) {
      counter++;
    }
  }
  if (counter >= minDigit) {
    return true;
  }
  return false;
}