Java by API/java.text/StringCharacterIterator
new StringCharacterIterator(String text)
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
public class Main {
private static final String text = "this is a test";
public static void main(String[] args) {
CharacterIterator it = new StringCharacterIterator(text);
for (char ch = it.last(); ch != CharacterIterator.DONE; ch = it.previous()) {
System.out.print(ch);
}
}
}
StringCharacterIterator: setText(String text)
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
public class Main {
public static void main(String[] argv) throws Exception {
CharacterIterator it = new StringCharacterIterator("abcd");
((StringCharacterIterator) it).setText("efgh");
char ch = it.current();
}
}