isChar function

bool isChar(
  1. String cc, {
  2. bool digit = false,
  3. bool upper = false,
  4. bool lower = false,
  5. bool whitespace = false,
  6. String? match,
})

Returns whether the character matches the specified conditions.

  • cc is the character to test.
  • digit specifies if it matches digit.
  • upper specifies if it matches upper case.
  • lower specifies if it matches lower case.
  • whitespace specifies if it matches whitespace.
  • match specifies a string of characters that are matched (aka., allowed).

Implementation

bool isChar(String cc, {bool digit = false, bool upper = false,
      bool lower = false, bool whitespace = false, String? match})
=> cc.isNotEmpty
  && isCharCode(cc.codeUnitAt(0), digit: digit, upper: upper,
        lower: lower, whitespace: whitespace)
      || (match?.contains(cc) ?? false);