Here you can find the source of csvToArray(String line)
public static String[][] csvToArray(String line)
//package com.java2s; //License from project: Apache License public class Main { public static String[][] csvToArray(String line) { return csvTextToArray(line, ','); }/*ww w . j a v a 2 s . c o m*/ public static String[][] csvTextToArray(String line, char separator) { line = toNLineSeparator(line); String[] lines = line.split("\n"); String ret[][] = new String[lines.length][0]; for (int i = 0; i < lines.length; i++) { String csv[] = lines[i].split("" + separator); ret[i] = new String[csv.length]; for (int j = 0; j < csv.length; j++) { ret[i][j] = csv[j]; } } return ret; } public static String toNLineSeparator(String text) { String ret = text.replace("\r\n", "\n"); ret = ret.replace("\r", "\n"); return ret; } }