getCellColNo static method

int getCellColNo(
  1. String colNoStr,
  2. int rowId
)

Function for getting cell number

Implementation

static int getCellColNo(String colNoStr, int rowId) {
  int colNo = 0;
  String colNoOnlyStr = colNoStr.replaceAll(rowId.toString(), "");

  for (int i = 0; i < colNoOnlyStr.length; i++) {
    if (i == colNoOnlyStr.length - 1) {
      colNo = colNo + Alphabet.alphabets.indexOf(colNoOnlyStr[i]) + 1;
    } else {
      colNo = colNo + ((Alphabet.alphabets.indexOf(colNoOnlyStr[i]) + 1) * 26);
    }
  }

  return colNo;
}