public static String[] parse(String line) {boolean insideQuote = false;ArrayList<String> result = new ArrayList<>();int quoteCount = 0;StringBuilder sb = new StringBuilder();for(int i = 0; i < line.length(); i++) {char c = line.charAt(i);if(c == QUOTE) {insideQuote = !insideQuote;quoteCount++;}if(c == COMMA && !insideQuote) {String value = sb.toString();value = unQuoteUnEscape(value);result.add(value);sb.setLength(0);continue;}sb.append(c);}result.add(sb.toString());if(quoteCount % 2 != 0) {return new String[0];}return result.toArray(new String[0]);}
public static string[] Parse(string line){bool insideQuote = false;List<string> result = new List<string>();int quoteCount = 0;StringBuilder sb = new StringBuilder();for (int i = 0; i < line.Length; i++){char c = line[i];if (c == QUOTE){insideQuote = !insideQuote;quoteCount++;}if (c == COMMA && !insideQuote){string value = sb.ToString();value = UnQuoteUnEscape(value);result.Add(value);sb.Length = 0;continue;}sb.Append(c);}result.Add(sb.ToString());if (quoteCount % 2 != 0){return new string[0];}return result.ToArray();}