Java tutorial
import java.text.CharacterIterator; import java.text.StringCharacterIterator; public class Main { public static void main(String[] argv) throws Exception { CharacterIterator it = new StringCharacterIterator("abcd"); int begin = 5; int end = 9; int pos = 6; it = new StringCharacterIterator("abcd efgh ijkl", begin, end, pos); char ch = it.current(); System.out.println(ch); ch = it.last(); System.out.println(ch); } }