Java String Split split(String arg)

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

Description

Converts a comma-delimited string to a list

License

Open Source License

Parameter

Parameter Description
arg Comma-delimited string to convert

Return

List of strings

Declaration

public static List<String> split(String arg) 

Method Source Code


//package com.java2s;
/*/*  www  .  j  ava  2  s  .  c  o m*/
 * HawkEye Redux
 * Copyright (C) 2012-2013 Cubeville <http://www.cubeville.org> and contributors
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program 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 General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

import java.util.Arrays;
import java.util.List;

public class Main {
    /**
     * Converts a comma-delimited string to a list
     *
     * @param arg Comma-delimited string to convert
     * @return List of strings
     */
    public static List<String> split(String arg) {
        return split(arg, ",");
    }

    /**
     * Converts a delimited string to a list
     *
     * @param arg Delimited string to convert
     * @param delimiter String delimiter
     * @return List of strings
     */
    public static List<String> split(String arg, String delimiter) {
        return Arrays.asList(arg.split(delimiter));
    }
}

Related

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