CharacterClass.hex4 constructor

CharacterClass.hex4(
  1. int hex
)

Matches a character represented with hex Unicode value. Using \u notation with value range of \u0000 until \uFFFF. This allows matching of non-Latin characters.

Example:

var jpManjiMatch = CharacterClass.hex4(0x534D,);

Implementation

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