Android String Split explode(String original, String split)

Here you can find the source of explode(String original, String split)

Description

explode

Declaration

public static String[] explode(String original, String split) 

Method Source Code

//package com.java2s;
import java.util.ArrayList;

public class Main {
    public static String[] explode(String original, String split) {
        if (original == null || original.length() == 0 || split == null
                || split.length() == 0) {
            return new String[] { original };
        }//  w ww.  j av a  2 s . c  om
        ArrayList<String> strs = new ArrayList<String>();
        int index = 0;
        int len = split.length();
        while ((index = original.indexOf(split)) != -1) {
            strs.add(original.substring(0, index));
            original = original.substring(index + len);
        }
        strs.add(original);
        return strs.toArray(new String[0]);
    }
}

Related

  1. splitDirString(String dirSection)
  2. splitInts(String str)
  3. splitLast(String target, String pattern)
  4. splitSteps(String str, String split)
  5. splitString(String tokenedStr, String token)
  6. getFirstWord(String str)
  7. getLine(String text, int line)
  8. stringToLongArray(String src, String separator)
  9. strToArray(String string)