首页 > 代码库 > Excel Sheet Column Number

Excel Sheet Column Number

1   public int titleToNumber(String s) {2         if(s.length()==0) return 0;3          int res=0;4          for(int i=0;i<s.length();i++)5          {6              res+=(s.charAt(i)-‘A‘+1)*Math.pow(26, s.length()-i-1);7          }8         return res;9     }

 

Excel Sheet Column Number