getColumnLabel static method

String getColumnLabel(
  1. int index
)

Converts index into A1 notation letter label 1 -> A 2 -> B 27 -> AA

Implementation

static String getColumnLabel(int index) {
  final res = <String>[];
  var block = index - 1;
  while (block >= 0) {
    res.insert(0, String.fromCharCode((block % 26) + _charCodeUnitA));
    block = block ~/ 26 - 1;
  }
  return res.join();
}