Here you can find the source of splitResponses(String text)
public static List<String> splitResponses(String text)
//package com.java2s; //License from project: Apache License import java.util.ArrayList; import java.util.List; public class Main { public static List<String> splitResponses(String text) { List<String> responses = new ArrayList<String>(); int start = 0; while (text.length() > 0) { final int i = text.indexOf('|', start); if (i < 0) { responses.add(text.replace("\\|", "|")); break; }/*from ww w .j a va 2s .co m*/ if (i > 0 && text.charAt(i - 1) == '\\') { start = i + 1; } else { responses.add(text.substring(0, i).replace("\\|", "|")); text = text.substring(i + 1); start = 0; } } return responses; } }