public Position getPosition ( final String pos ) { final String s = pos . toUpperCase ( Locale . US ) ; final int len = s . length ( ) ; int status = 0 ; int row = 0 ; int col = 0 ; int n = 0 ; while ( n < len ) { final char c = s . charAt ( n ) ; switch ( status ) { case BEGIN_LETTER : // opt $ case BEGIN_DIGIT : // opt $ status ++ ; if ( c == ' ' ) n ++ ; break ; case FIRST_LETTER : // mand letter if ( ' ' <= c && c <= ' ' ) { col = c - ' ' + 1 ; status = PositionUtil . OPT_SECOND_LETTER ; n ++ ; } else return null ; break ; case OPT_SECOND_LETTER : // opt letter if ( ' ' <= c && c <= ' ' ) { col = col * ALPHABET_SIZE + c - ORD_A + 1 ; n ++ ; } status = PositionUtil . BEGIN_DIGIT ; break ; case FIRST_DIGIT : // mand digit if ( ' ' <= c && c <= ' ' ) { row = c - ' ' ; status = PositionUtil . OPT_DIGIT ; n ++ ; } else return null ; break ; case OPT_DIGIT : // opt digit if ( ' ' <= c && c <= ' ' ) { row = row * 10 + c - ' ' ; n ++ ; } else return null ; break ; default : return null ; } } return new Position ( this . equalityUtil , this . tableNameUtil , row - 1 , col - 1 ) ; }
Convert a cell position string like B3 to the column number .