Android String Split split(String original, String separator)

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

Description

split

Declaration

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

Method Source Code

//package com.java2s;

import java.util.Vector;

public class Main {
    public static String[] split(String original, String separator) {
        Vector nodes = new Vector();

        // Parse nodes into vector
        int index = original.indexOf(separator);
        while (index >= 0) {
            nodes.addElement(original.substring(0, index));
            original = original.substring(index + separator.length());
            index = original.indexOf(separator);
        }/*  w  w  w.j  a  v a 2 s.c  o  m*/
        // Get the last node
        nodes.addElement(original);

        // Create splitted string array
        String[] result = new String[nodes.size()];
        if (nodes.size() > 0) {
            for (int loop = 0; loop < nodes.size(); loop++)
                result[loop] = (String) nodes.elementAt(loop);
        }
        return result;
    }
}

Related

  1. split(String original, String separator)
  2. split(String s, String sep)
  3. split(String source, String separator)
  4. split(String str, String delim)