Java String Split by Delimiter splitKeepDelimiter(String delimiter, String input)

Here you can find the source of splitKeepDelimiter(String delimiter, String input)

Description

split Keep Delimiter

License

Open Source License

Declaration

public static List<String> splitKeepDelimiter(String delimiter, String input) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Arrays;

import java.util.List;

public class Main {
    public static List<String> splitKeepDelimiter(String delimiter, String input) {
        return Arrays.asList(input.split(//
                "(?i)" // case insensitive
                        + "((?<="//
                        + delimiter//
                        + ")|(?="//
                        + delimiter//
                        + "))"//
        ));/*from  w w  w .  j  av a  2 s .  c  o  m*/
    }
}

Related

  1. splitByStr(String s, String delim)
  2. splitChars(String str, String delimiters)
  3. splitFast(String text, char delim)
  4. splitForChar(final String string, final char delimiter)
  5. splitHtmlTagKeepDelimiter(String tag, String input)
  6. splitList(String data, String delims)
  7. splitNestedString(String params, String delimStr, int numLeft, int numRight)
  8. splitNoCoalesce(String s, char delimiter)
  9. splitOnEntireString(String target, String delimiter)