CharacterClass.hex2 constructor

CharacterClass.hex2(
  1. int hex
)

Matches a character represented with hex ASCII value. Using \x notation with value range of \x00 until \xFF (Available standard ASCII characters).

Example:

// Matching letter 'A'
var matchLetterA = CharacterClass.hex2(0x41,);

Implementation

factory CharacterClass.hex2(int hex,) {
  if (hex >= 0 && hex <= 0xFF) {
    return CharacterClass._raw("\\x${hex.toRadixString(16,)}",);
  }
  throw ArgumentError.value(hex, "Hex Value", "Must be between 0x00 and 0xFF inclusive",);
}