Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {
    public static String[] split(String paramString1, String paramString2) {
        int i = paramString1.indexOf(paramString2);
        if (i == -1)
            return new String[] { paramString1 };
        ArrayList localArrayList = new ArrayList();
        int j = 0;
        while (i != -1) {
            localArrayList.add(paramString1.substring(j, i));
            j = i + paramString2.length();
            i = paramString1.indexOf(paramString2, j);
        }
        if (j != paramString1.length())
            localArrayList.add(paramString1.substring(j));
        return (String[]) localArrayList.toArray(new String[localArrayList.size()]);
    }
}