public static int getGenre ( String str ) { for ( int i = 0 ; i < GENRES . length ; i ++ ) if ( GENRES [ i ] . equalsIgnoreCase ( str ) ) return i ; return - 1 ; }
Tries to find the string provided in the table and returns the corresponding int code if successful . Returns - 1 if the genres is not found in the table .