原理:
[a1-z26]*26^n-1 + [a1-z26]*26^n-2 + ... + [a1-z26]*26^0
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.util.HashMap;
import java.util.Map;
/**
*
* @author jdkleo
*/
public class ExcelUtil {
public static int getCellNum(String cellStr) {
char[] cellStrArray = cellStr.toUpperCase().toCharArray();
int len = cellStrArray.length;
int n = 0;
for(int i=0;i<len;i++){
n += (((int)cellStrArray[i])-65+1)*Math.pow(26, len-i-1);
}
return n-1;
}
public static void main(String[] args) {
System.out.print(getCellNum("aaa"));
}
}