Java String Split getInputs(String str)

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

Description

get Inputs

License

Open Source License

Declaration

public static final String[] getInputs(String str) 

Method Source Code


//package com.java2s;
/*/*from   w w w .j a  v a 2s  .  co m*/
 * Copyright 1999-2004 Alibaba.com All right reserved. This software is the confidential and proprietary information of
 * Alibaba.com ("Confidential Information"). You shall not disclose such Confidential Information and shall use it only
 * in accordance with the terms of the license agreement you entered into with Alibaba.com.
 */

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static final String[] getInputs(String str) {
        if (str == null) {
            return null;
        }

        String[] splits = str.split(",");

        List<String> list = new ArrayList<String>();

        for (String split : splits) {
            if (!split.trim().equals("")) {
                list.add(split);
            }
        }

        return list.toArray(new String[] {});
    }
}

Related

  1. getParameters(String[] split)
  2. getUsedInputs(String expression)
  3. recursiveSplit(String str, String splitor)
  4. safeSplitParameters(String parameters)