isPassengerSeat method

dynamic isPassengerSeat(
  1. String s
)

format: "1B", "1A", "2A", "12A", "299C"; contains a number less than 300 and an alpha letter (a-zA-Z)

Implementation

isPassengerSeat(String s) {
  bool b = false;
  s = s.trim();
  // //this layer handles little mistakes!
  // if (nextItem != '' && isNumeric(nextItem)) {
  //   if (s.length == 3) {
  //     s = s[0] +
  //         s[1] +
  //         (s[2].replaceAll('8', 'b').replaceAll("0", "o").replaceAll('2', 'z').replaceAll("9", "g"));
  //   }
  //   if (s.length > 2 && isAlpha(s[s.length - 2])) {
  //     s = s.substring(0, s.length - 1);
  //   }
  // }
  //this is the main check!
  if (s.length > 1 &&
      s.length < 5 &&
      isNumeric(s.substring(0, s.length - 1)) &&
      isAlpha(s.substring(s.length - 1, s.length))) b = true;
  return b;
}