public static int startsWith ( String str , String [ ] arr ) { if ( arr == null ) { return - 1 ; } for ( int i = 0 ; i < arr . length ; i ++ ) { if ( arr [ i ] . startsWith ( str ) ) { return i ; } } return - 1 ; }
check if there is an element that starts with the specified string