hasNonZeroDigit static method

bool hasNonZeroDigit(
  1. String digitSequence
)

check if the string has a non-zero digit

Implementation

static bool hasNonZeroDigit(String digitSequence) {
  bool foundNonZero = false;

  for (int i = 0; i <= digitSequence.length - 1; i++) {
    foundNonZero = digitSequence[i].codeUnitAt(0) != 48;

    if (foundNonZero) {
      break;
    }
  }

  return foundNonZero;
}