public static String findEditTable(String tables){
  if (!StringUtils.isEmpty(tables)) {
    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");
  }
}

public static String findEditTable ( String tables ) { if ( ! StringUtils . isEmpty ( tables ) ) { 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 .
