Java String Split splitParameters(String parameters)

Here you can find the source of splitParameters(String parameters)

Description

split Parameters

License

Open Source License

Declaration

public static List<String> splitParameters(String parameters) 

Method Source Code

//package com.java2s;
/* Soot - a Java Optimization Framework
 * Copyright (C) 2012 Michael Markert, Frank Hartmann
 * /*ww  w.j ava2s  . c o  m*/
 * (c) 2012 University of Luxembourg - Interdisciplinary Centre for
 * Security Reliability and Trust (SnT) - All rights reserved
 * Alexandre Bartel
 * 
 *
 * 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; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * 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.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 * Boston, MA 02111-1307, USA.
 */

import java.util.ArrayList;

import java.util.List;

public class Main {
    public static List<String> splitParameters(String parameters) {
        List<String> pList = new ArrayList<String>();

        int idx = 0;
        boolean object = false;

        String curr = "";
        while (idx < parameters.length()) {
            char c = parameters.charAt(idx);
            curr += c;
            switch (c) {
            // array
            case '[':
                break;
            // end of object
            case ';':
                object = false;
                pList.add(curr);
                curr = "";
                break;
            // start of object
            case 'L':
                object = true;
                break;
            default:
                if (object) {
                    // caracter part of object
                } else { // primitive
                    pList.add(curr);
                    curr = "";
                }
                break;

            }
            idx++;
        }

        return pList;
    }
}

Related

  1. splitOnTokens(String text)
  2. splitOrderedDurationsIntoIntervals(String[] durations, int numberOfIntervals)
  3. splitPackageName(String packageName)
  4. splitPackages(String packages)
  5. splitParagraphs(String value)
  6. splitParameters(String parameterString)
  7. splitParameterString(String theInput, boolean theUnescapeComponents)
  8. splitPartitionColStats(String key)
  9. splitResponses(String text)