Java String Split split(String candidate)

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

Description

split

License

Open Source License

Declaration

private static List<String> split(String candidate) 

Method Source Code


//package com.java2s;
/*//from  w  w  w.  j  a  v  a 2s . c o m
 *    Geotoolkit - An Open Source Java GIS Toolkit
 *    http://www.geotoolkit.org
 *
 *    (C) 2012-2013, Geomatys
 *
 *    This library is free software; you can redistribute it and/or
 *    modify it under the terms of the GNU Lesser General Public
 *    License as published by the Free Software Foundation;
 *    version 2.1 of the License.
 *
 *    This library is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *    Lesser General Public License for more details.
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    private static List<String> split(String candidate) {

        final List<String> parts = new ArrayList<String>();
        int index = candidate.indexOf(':');
        while (index > 0) {
            final String strLenght = candidate.substring(0, index);
            final int size = Integer.parseInt(strLenght);
            final String part = candidate.substring(index + 1, index + size + 1);
            parts.add(part);

            candidate = candidate.substring(index + size + 1);
            index = candidate.indexOf(':');
        }

        return parts;
    }
}

Related

  1. split(final String string, final String toSplit)
  2. split(final String text, final String sp)
  3. split(final String toSplit)
  4. split(Iterable objects, boolean even)
  5. split(String arg)
  6. split(String cmd)
  7. split(String content)
  8. Split(String content, String sub_seq)
  9. split(String input)