Here you can find the source of parseArray(String inputArray)
public static String[] parseArray(String inputArray)
//package com.java2s; /*/*from w w w . jav a 2s . co m*/ * * AWTRY (Another Way To Read YAML) - YAML reader for Java. * Copyright (C) 2015 TheRealBuggy/JonathanxD (Jonathan Ribeiro Lopes) <jonathan.scripter@programmer.net> * * GNU GPLv3 * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as published * by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.util.ArrayList; public class Main { public static String[] parseArray(String inputArray) { ArrayList<String> result = new ArrayList<String>(); int start = 0; boolean quote = false; for (int x = 0; x < inputArray.length(); x++) { if (inputArray.charAt(x) == '\"') quote = !quote; boolean lastChar = (x == inputArray.length() - 1); if (lastChar) { result.add(inputArray.substring(start).trim()); } else if (inputArray.charAt(x) == ',' && !quote) { result.add(inputArray.substring(start, x).trim()); start = x + 1; } } return result.toArray(new String[result.size()]); } }