Java Array From arrayFromString(String s)

Here you can find the source of arrayFromString(String s)

Description

array From String

License

Open Source License

Declaration

public static String[] arrayFromString(String s) 

Method Source Code

//package com.java2s;
//  are made available under the terms of the Eclipse Public License v1.0

public class Main {
    public static String[] arrayFromString(String s) {
        if (s == null)
            return new String[] {};

        if (!s.startsWith("[") || !s.endsWith("]"))
            throw new IllegalArgumentException();
        if (s.length() == 2)
            return new String[] {};

        return s.substring(1, s.length() - 1).split(" *, *");
    }//from  w  w w .  ja  va 2 s. com
}

Related

  1. arrayFromArrayWithLength(final byte[] array, final int length)
  2. arrayFromIndex(double[][] values, int index)
  3. arrayFromList(String aList)
  4. arrayFromString(String fromString)
  5. arrayFromString(String str)
  6. toArray(boolean[] array)
  7. toArray(CharSequence input)
  8. toArray(Class interfaceClass)