Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.
Date: 2013feb5 Language: Java Q. How can I use StreamTokenizer on a string? A. Use ByteArrayInputStream to make an InputStream and then convert that into a Reader:String s = "String I want to parse"; InputStream is = new ByteArrayInputStream(s.getBytes()); Reader r = new BufferedReader(new InputStreamReader(is)); StreamTokenizer tokenizer = new StreamTokenizer(r); // You can now use tokenizer
Add a commentSign in to add a comment