Java Utililty Methods String Split

List of utility methods to do String Split

Description

The list of methods to do String Split are organized into topic(s).

Method

String[]splitString(String src, String target)
split String
return src.split("\\Q" + target + "\\E");
VectorsplitString(String string)
split String
Vector vr = new Vector();
StringTokenizer stok = new StringTokenizer(string, " ");
while (stok.hasMoreTokens()) {
    vr.addElement(stok.nextToken());
return vr;
ListsplitString(String string, int limit)
Splits a string by char limit, not breaking works.
List<String> list = new ArrayList<String>();
char[] chars = string.toCharArray();
boolean endOfString = false;
int start = 0;
int end = start;
while (start < chars.length - 1) {
    int charCount = 0;
    int lastSpace = 0;
...
String[]splitStringBySeperator(final String str, final String seperator)
split String By Seperator
if (str == null) {
    return null;
String sep = seperator;
if (sep == null) {
    sep = " ";
if (sep.equals("")) {
...
voidsplitStrings(String start, String end, int numSplitStrings, boolean oddLevel, List splits)
Recursive helper for splitStrings.
if (numSplitStrings <= 0) {
    return;
String midString = findMidpoint(start, end);
int numSplitStringsRemaining = numSplitStrings - 1;
int leftOffset = 0;
int rightOffset = 0;
if (numSplitStringsRemaining % 2 == 1) {
...
ListsplitStringToList(String pstrString, String pstrSep)
split String To List
if (pstrString == null || pstrSep == null) {
    return new ArrayList<String>();
return new ArrayList<String>(Arrays.asList(pstrString.split(pstrSep)));
ListsplitStringWithoutTrim(String strInput, String strSplitor)
Split String to List
List listResult = new ArrayList();
if (strInput == null) {
    return null;
int start = 0;
int end = strInput.length();
while (start < end) {
    int delimIdx = strInput.indexOf(strSplitor, start);
...
VectorsplitStruct(String struct)
split Struct
Vector vr = new Vector();
if (struct.startsWith("[") && struct.endsWith("]")) {
    struct = struct.substring(1, struct.length() - 1);
StringTokenizer stok = new StringTokenizer(struct, " ");
while (stok.hasMoreTokens()) {
    String tok = stok.nextToken();
    if (tok.startsWith("[")) {
...
ArrayListsplitSubstring(String str, String substr)
split Substring
ArrayList<String> split = new ArrayList<String>();
int idx_s = 0;
int idx_e = str.indexOf(substr);
while (idx_e > -1) {
    String f = str.substring(idx_s, idx_e);
    split.add(f.trim());
    idx_s = idx_e + substr.length();
    idx_e = str.indexOf(substr, idx_s);
...
ArrayListsplitTags(final String tagsString)
Split tags.
final ArrayList<String> tagsList = new ArrayList<String>();
String tagsCopy = tagsString;
if (tagsString == null) {
    return tagsList;
tagsCopy = tagsCopy.replaceAll(",", " ");
tagsCopy = tagsCopy.replaceAll("\"", "");
tagsCopy = tagsCopy.replaceAll("\'", "");
...