Java String Split splitResponses(String text)

Here you can find the source of splitResponses(String text)

Description

split Responses

License

Apache License

Declaration

public static List<String> splitResponses(String text) 

Method Source Code


//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;
    }
}

Related

  1. splitParagraphs(String value)
  2. splitParameters(String parameters)
  3. splitParameters(String parameterString)
  4. splitParameterString(String theInput, boolean theUnescapeComponents)
  5. splitPartitionColStats(String key)
  6. splitScopes(String aActivityPath)
  7. splitScriptToQueries(String script)
  8. SplitSearchTerms(String strSearch)
  9. splitSelection(String selection)