@Test public void testGetColumnIndex() { assertEquals(0, SpreadsheetUtils.getColumnIndex("A")); assertEquals(4, SpreadsheetUtils.getColumnIndex("E")); assertEquals(25, SpreadsheetUtils.getColumnIndex("Z")); assertEquals(26, SpreadsheetUtils.getColumnIndex("AA")); assertEquals(457833, SpreadsheetUtils.getColumnIndex("ZAFZ")); }
public static int getColumnIndex(String column) { int result = -1; char a = 'A' - 1; char[] chars = column.toCharArray(); for (int i = 0; i < chars.length; i++) { int pos = (chars[i] - a); result += pos * Math.pow(26, chars.length - i - 1); } return result; }
SpreadsheetUtils { public static int getColumnIndex(String column) { int result = -1; char a = 'A' - 1; char[] chars = column.toCharArray(); for (int i = 0; i < chars.length; i++) { int pos = (chars[i] - a); result += pos * Math.pow(26, chars.length - i - 1); } return result; } }
SpreadsheetUtils { public static int getColumnIndex(String column) { int result = -1; char a = 'A' - 1; char[] chars = column.toCharArray(); for (int i = 0; i < chars.length; i++) { int pos = (chars[i] - a); result += pos * Math.pow(26, chars.length - i - 1); } return result; }  }
SpreadsheetUtils { public static int getColumnIndex(String column) { int result = -1; char a = 'A' - 1; char[] chars = column.toCharArray(); for (int i = 0; i < chars.length; i++) { int pos = (chars[i] - a); result += pos * Math.pow(26, chars.length - i - 1); } return result; }  static int getColumnIndex(String column); static String getColumnLabel(int column); static String getPortName(String columnLabel, JsonNode jsonNode); static String getPortName(int columnIndex, JsonNode jsonNode); static Range getRange(JsonNode jsonNode); }
SpreadsheetUtils { public static int getColumnIndex(String column) { int result = -1; char a = 'A' - 1; char[] chars = column.toCharArray(); for (int i = 0; i < chars.length; i++) { int pos = (chars[i] - a); result += pos * Math.pow(26, chars.length - i - 1); } return result; }  static int getColumnIndex(String column); static String getColumnLabel(int column); static String getPortName(String columnLabel, JsonNode jsonNode); static String getPortName(int columnIndex, JsonNode jsonNode); static Range getRange(JsonNode jsonNode);  }