class DelimitedStringHelper {

	public static List<String> splitLine(String line, char splitCharacter, char quoteCharacter,
			boolean unescapeDoubleQuotes) {
		Objects.requireNonNull(line, "line must not be null");
		List<String> split = new ArrayList<>();
		boolean inQuotes = false;
		int previousIdx = 0;
		for (int idx = 0; idx < line.length(); idx++) {
			char c = line.charAt(idx);
			if (c == splitCharacter && !inQuotes) {
				split.add(trimQuotes(line.substring(previousIdx, idx), quoteCharacter, unescapeDoubleQuotes));
				previousIdx = idx + 1;
			} else if (c == quoteCharacter) {
				inQuotes = !inQuotes;
			}
		}
		if (inQuotes) {
			return null;
		}
		split.add(trimQuotes(line.substring(previousIdx), quoteCharacter, unescapeDoubleQuotes));
		return split;
	}

	private  DelimitedStringHelper();

}