Java String Split split(String text, String token)

Here you can find the source of split(String text, String token)

Description

split

License

Apache License

Declaration

public static List split(String text, String token) 

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 split(String text, String token) {
        List list = new ArrayList();
        int start = 0;
        int end = -1;
        while ((end = text.indexOf(token, start)) != -1) {
            list.add(text.substring(start, end));

            start = end + token.length();
        }/*from w  ww  .  j a va 2s  .  co m*/
        list.add(text.substring(start));
        return list;
    }
}

Related

  1. split(String string, String seperator)
  2. split(String strSource, String strReg)
  3. split(String text)
  4. split(String text)
  5. split(String text)
  6. split(String token, String s)
  7. split(String toSplit)
  8. split(String value)
  9. split(String value)