isLength function

bool isLength (
  1. String str,
  2. int min,
  3. [int max]
)

check if the length of the string str falls in a range

Implementation

bool isLength(String str, int min, [int max]) {
  List surrogatePairs = _surrogatePairsRegExp.allMatches(str).toList();
  int len = str.length - surrogatePairs.length;
  return len >= min && (max == null || len <= max);
}