isTagName static method

bool isTagName(
  1. String n
)

/////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////// Returns if the given string is a legal tag name.

The first char must be ASCII lower case letter. Rest of chars must be ASCII letter, digit, or underbar.

Implementation

// Encoding
//////////////////////////////////////////////////////////////////////////

  /// Returns if the given string is a legal tag name.
  ///
  /// The first char must be ASCII lower case letter. Rest of
  /// chars must be ASCII letter, digit, or underbar.
  static bool isTagName(String n) {
    if (n.isEmpty) return false;
    int first = n.codeUnitAt(0);
    if (first < a_CHAR || first > z_CHAR) return false;

    return n.codeUnits.every((int c) => c < 128 && _tagChars[c]);
  }