Iterate a subset of a string
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
public class Main {
public static void main(String[] args) {
String text = "this is a test";
CharacterIterator it = new StringCharacterIterator(text, 4, 27, 5);
for (char ch = it.first(); ch != CharacterIterator.DONE; ch = it.next()) {
System.out.print(ch);
}
}
}
Related examples in the same category