public static String findEditTable ( String tables ) { if ( ! TextUtils . isEmpty ( tables ) ) { // find the first word terminated by either a space or a comma int spacepos = tables . indexOf ( ' ' ) ; int commapos = tables . indexOf ( ' ' ) ; if ( spacepos > 0 && ( spacepos < commapos || commapos < 0 ) ) { return tables . substring ( 0 , spacepos ) ; } else if ( commapos > 0 && ( commapos < spacepos || spacepos < 0 ) ) { return tables . substring ( 0 , commapos ) ; } return tables ; } else { throw new IllegalStateException ( "Invalid tables" ) ; } }
Finds the name of the first table which is editable .