public static boolean checkAbreviations ( String string , int i ) { // Check first character for ( int index = 0 ; index < ABREVIATIONS . length ; index ++ ) { if ( ABREVIATIONS [ index ] . length ( ) > 1 ) if ( string . charAt ( i ) == ABREVIATIONS [ index ] . charAt ( 0 ) ) if ( string . length ( ) > i + 1 ) if ( string . charAt ( i + 1 ) == ABREVIATIONS [ index ] . charAt ( 1 ) ) if ( string . length ( ) > i + 2 ) if ( string . charAt ( i + 2 ) == ABREVIATIONS [ index ] . charAt ( 2 ) ) return true ; } // Check second character for ( int index = 0 ; index < ABREVIATIONS . length ; index ++ ) { if ( ABREVIATIONS [ index ] . length ( ) > 2 ) if ( i > 0 ) if ( string . charAt ( i - 1 ) == ABREVIATIONS [ index ] . charAt ( 0 ) ) if ( string . charAt ( i ) == ABREVIATIONS [ index ] . charAt ( 1 ) ) if ( string . length ( ) > i + 1 ) if ( string . charAt ( i + 1 ) == ABREVIATIONS [ index ] . charAt ( 2 ) ) return true ; } return false ; }
CheckAbreviations Method .