private boolean isGoodAnchor ( String text , int index ) { // Check if there is space and punctuation mark after block String punct = " .,:!?\t\n" ; if ( index >= 0 && index < text . length ( ) ) { if ( punct . indexOf ( text . charAt ( index ) ) == - 1 ) { return false ; } } return true ; }
Test if symbol at index is space or out of string bounds