Related to question Excel Sheet Column Titlejava
Given a column title as appear in an Excel sheet, return its corresponding column number.app
For example:spa
A -> 1 B -> 2 C -> 3 ... Z -> 26 AA -> 27 AB -> 28
public class Solution { public int titleToNumber(String s) { String ups=s.toUpperCase(); int result =0; int deliver = 1; char[] temp = ups.toCharArray(); for(int i=temp.length-1;i>=0;i--){ result +=CharToNumber(temp[i])*deliver; deliver*=26; } return result; } public int CharToNumber(char c){ return (c-'A'+1); } }