posted 15 years ago
I'll guess that the exception that you were actually getting was the StringIndexOutOfBoundsException. Taking a look at the documentation for StringIndexOutOfBoundsException we find a simple explanation for when this exception is thrown:
Are you sure that you aren't trying to search a String beyond it's length? Are you getting any ideas?Thrown by String methods to indicate that an index is either negative or greater than the size of the string. For some methods such as the charAt method, this exception also is thrown when the index is equal to the size of the string.