I was working on a search method and I've almost completed it. However there's just one slight problem with it that can't seem to be able to fix. If I search for 1 character it works fine, but when I have two or more character the complier gives me an out of bound index error.
Here's the code:
And the error message:
java.lang.StringIndexOutOfBoundsException: String index out of range: 29 at java.lang.String.charAt(String.java:460) at MainClass.main(MainClass.java:25) Exception in thread "main"
java:25 (line 25) is where there's c[j] = str1.charAt(i+j). I messed around a bit if the for loops that have the variable i and j but it seems to have no effect.
Any suggestions? :roll: [ March 01, 2008: Message edited by: Olivier Legat ]