Here you can find the source of splitToPairs(String Line)
public static String[] splitToPairs(String Line)
//package com.java2s; //License from project: Open Source License import java.util.ArrayList; public class Main { public static String[] splitToPairs(String Line) { Line = Line.replace(" + ", ", "); ArrayList<String> result = new ArrayList<>(); boolean foundQwote = false; String pair = ""; for (int idx = 0; idx < Line.length(); idx++) { if (Line.charAt(idx) == '"') { foundQwote = !foundQwote; } else if (Line.charAt(idx) == ',') { if (!foundQwote) { result.add(pair.trim()); pair = ""; } else { pair = pair + Line.charAt(idx); }/* ww w . j a v a 2 s. c o m*/ } else { pair = pair + Line.charAt(idx); } } result.add(pair.trim()); return result.toArray(new String[result.size()]); } }