Java String Split by Regex splitString(String str, List list, String regex)

Here you can find the source of splitString(String str, List list, String regex)

Description

split String

License

Open Source License

Declaration

private static void splitString(String str, List<String> list, String regex) 

Method Source Code

//package com.java2s;
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt

import java.util.List;

public class Main {
    private static void splitString(String str, List<String> list, String regex) {
        int indexOf = str.indexOf(regex);
        if (indexOf > -1) {
            list.add(str.substring(0, indexOf));
            splitString(str.substring(indexOf + 1, str.length()), list, regex);
        } else {//from   ww  w  .  j  av a  2  s .  co m
            list.add(str);
        }
    }
}

Related

  1. split(String string, String pattern)
  2. split(String text, String pattern)
  3. splitAndTrim(String s, String regex)
  4. splitList(String list, String splitRegex)
  5. splitNoEmpty(String sStr, String regex)
  6. splitStringToList(String input, String regex)
  7. splitTerms(String text, String pattern)
  8. splitToList(String s, String regex)
  9. splitToLongList(String str, String regex)