private String englishLanguageFirstSentence ( String s ) { if ( s == null ) { return null ; } int len = s . length ( ) ; boolean period = false ; for ( int i = 0 ; i < len ; i ++ ) { switch ( s . charAt ( i ) ) { case ' ' : period = true ; break ; case ' ' : case ' ' : case ' ' : case ' ' : case ' ' : if ( period ) { return s . substring ( 0 , i ) ; } break ; case ' ' : if ( i > 0 ) { if ( htmlSentenceTerminatorFound ( s , i ) ) { return s . substring ( 0 , i ) ; } } break ; default : period = false ; } } return s ; }
Return the first sentence of a string where a sentence ends with a period followed be white space .