You can use following code to iterate a subset of a string.
Code:
package org.kodejava.example.text;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
public class IterateofSubstringEg {
private static final String text =
"How razorback-jumping frogs can level six piqued gymnasts";
public static void main(String[] args) {
CharacterIterator iter = new StringCharacterIterator(text, 4, 27, 5);
/
for (char che = iter.first(); che != CharacterIterator.DONE; che = iter.next()) {
System.out.print(che);
}
}
}
Bookmarks