Java String Split split(String str)

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

Description

split

License

Open Source License

Declaration

public static String[] split(String str) 

Method Source Code


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

import java.util.*;

public class Main {

    public static String[] split(String str) {
        ArrayList<String> list = new ArrayList<>();
        int s = 0, n = str.length();
        for (;;) {
            while (s < n && Character.isWhitespace(str.charAt(s)))
                s++;// ww w  .  j a v a 2s .  c  o  m
            if (s == n)
                break;
            int t = s;
            while (t < n && !Character.isWhitespace(str.charAt(t)))
                t++;
            list.add(str.substring(s, t));
            s = t;
        }
        return list.toArray(new String[0]);
    }
}

Related

  1. split(String signature, boolean skipInitialAngleBracket)
  2. split(String source, String seperator)
  3. split(String str)
  4. split(String str)
  5. split(String str)
  6. split(String str)
  7. split(String str)
  8. split(String str)
  9. split(String str)