Java String Split split(String str, String splitStr)

Here you can find the source of split(String str, String splitStr)

Description

split

License

Open Source License

Declaration

public static String[] split(String str, String splitStr) 

Method Source Code

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

import java.util.ArrayList;

import java.util.List;

public class Main {

    public static String[] split(String str, String splitStr) {
        List<String> dataList = new ArrayList<String>();
        int indx = str.indexOf(splitStr);
        while (indx >= 0) {
            dataList.add(str.substring(0, indx));
            str = str.substring(indx + splitStr.length());
            indx = str.indexOf(splitStr);
        }/*w w w  . ja v  a  2 s . co  m*/
        dataList.add(str);

        String[] datas = new String[dataList.size()];
        for (int i = 0; i < dataList.size(); i++) {
            datas[i] = dataList.get(i);
        }
        return datas;
    }
}

Related

  1. split(String str)
  2. split(String str)
  3. split(String str)
  4. split(String str, int ch)
  5. split(String str, String id)
  6. split(String str, String splitter)
  7. split(String str, String token)
  8. split(String string)
  9. split(String string)