Code example for StreamTokenizer

Methods: lowerCaseMode, nextToken

0
import junit.framework.TestCase; 
 
public class StreamTokenizerTest extends TestCase {
    public void testLowerCase() throws Exception { 
        Locale.setDefault(Locale.US);
        StreamTokenizer st = new StreamTokenizer(new StringReader("aIb aIb"));
        st.lowerCaseMode(true);
        st.nextToken();
        assertEquals("aib", st.sval);
 
        Locale.setDefault(new Locale("tr", "TR"));
        st.nextToken();
        assertEquals("a\u0131b", st.sval);
    } 
}