private static int sentenceCount ( String strText ) { int numberOfDots = PHPMethods . substr_count ( strText , ' ' ) ; // Will be tripped up by "Mr." or "U.K.". Not a major concern at this point. if ( strText . charAt ( strText . length ( ) - 1 ) != ' ' ) { //missing the final dot, count it too ++ numberOfDots ; } return Math . max ( 1 , numberOfDots ) ; }
Returns sentence count for text .