View Single Post
  #2 (permalink)  
Old 03-31-2008, 06:30 PM
hardwired hardwired is offline
Senior Member
 
Join Date: Jul 2007
Posts: 1,104
hardwired is on a distinguished road
Quote:
C:\jexp>java FleschIndex
The extract is:The string tokenizer class allows an application to break a string into tok
ens. Hello.
Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of
range: -2
at java.lang.String.charAt(Unknown Source)
at FleschIndex.readabilityIndex(FleschIndex.java:59)
at FleschIndex.main(FleschIndex.java:114)
Code:
char endLetter; // If word.indexOf(" ") = -1 // then word.indexOf(" ")-1 will evaluate to -2. //endLetter=word.charAt(word.indexOf(" ")-1); // Try: endLetter = word.charAt(word.length()-1);
Reply With Quote