Java tutorial
//package com.java2s; import java.io.IOException; import java.io.StringReader; public class Main { public static double readDouble(StringReader reader, char delimiter) throws NumberFormatException { String str = readString(reader, delimiter); if (str.length() == 0) { return 0.0d; } else { return Double.parseDouble(str); } } public static String readString(StringReader sr, char delimiter) { try { StringBuilder sb = new StringBuilder(); char c; while ((c = (char) sr.read()) != (char) -1) { if (c == '\\') { // This is an escape character. Jump past to the next char. sb.append((char) sr.read()); } else if (c == delimiter) { break; } else { sb.append(c); } } return sb.toString(); } catch (IOException e) { // Cannot happen as there is no IO here - just a read from a string throw new RuntimeException("Unexpected IOException", e); } } }