inspect method

void inspect(
  1. String text
)

Analyzes the text and updates letter and digit counts.

Iterates through each character in the input text and increments the appropriate counter based on character type.

Implementation

void inspect(final String text) {
  reset();

  for (final char in text.split('')) {
    if (isLetter(char)) {
      letters++;
      if (isUpperCase(char)) {
        uppercase++;
      } else {
        lowercase++;
      }
    } else {
      uppercase++;
      if (isDigit(char)) {
        digits++;
      }
    }
  }
}