lettersToNumeric function

int lettersToNumeric(
  1. String letters
)

Convert a character based column

Implementation

int lettersToNumeric(String letters) {
  var sum = 0, mul = 1, n = 1;
  for (var index = letters.length - 1; index >= 0; index--) {
    var c = letters[index].codeUnitAt(0);
    n = 1;
    if (65 <= c && c <= 90) {
      n += c - 65;
    } else if (97 <= c && c <= 122) {
      n += c - 97;
    }
    sum += n * mul;
    mul = mul * 26;
  }
  return sum;
}