0
Why substring fun is not working ?.......
3 Respuestas
+ 3
As I understand it, substring takes 2 arguments:
1. The index of the first character.
2. The index of the last character
The range of selection is <first index to last index - 1>. In your case, you should set it to `substring(3, 6)` and the method will return character from index 3, 4 and 5.
Something along this line;
str.substring(i, i + lenofsubstr));
+ 4
//substring(3,3) returns empty string so
System.out.println(str.substring( i , i+lenofsubstr )); // substring from i, to i+3
+ 4
Line 13 should be:
System.out.println(str.substring( i , i+lenofsubstr ));