Here you can find the source of splitToDouble(String input)
public static double[] splitToDouble(String input)
//package com.java2s; /* released under bsd licence * see LICENCE file or http://www.opensource.org/licenses/bsd-license.php for details * Institute of Applied Simulation (ZHAW) * Author Thomas Niederberger// w w w. j a va 2 s .c o m */ import java.util.ArrayList; import java.util.List; import java.util.Scanner; public class Main { public static double[] splitToDouble(String input) { Scanner s = new Scanner(input); s.useDelimiter("(,|;)\\s*"); List<Double> values = new ArrayList<Double>(); while (s.hasNext()) { if (s.hasNextDouble()) { values.add(s.nextDouble()); } else { //ignore s.next(); } } double[] converted = new double[values.size()]; for (int i = 0; i < converted.length; i++) { converted[i] = values.get(i); } return converted; } }