normalizeWithLength static method

String normalizeWithLength(
  1. String line, {
  2. int len = 44,
})

Implementation

static String normalizeWithLength(String line, {int len = 44}) {
  line = line.replaceAll(" ", '');
  final b = StringBuffer();
  for (final rune in line.toUpperCase().runes) {
    var ch = String.fromCharCode(rune);
    ch = _normMap[ch] ?? ch;
    final cu = ch.codeUnitAt(0);
    final isAZ = cu >= 65 && cu <= 90;
    final is09 = cu >= 48 && cu <= 57;
    if (isAZ || is09 || cu == 60) {
      b.writeCharCode(cu);
      if (b.length == len) break;
    }
  }
  while (b.length < len) b.write('<');
  return b.toString();
}