I have the printed value of an ArrayList of Strings.
[a, b, c, d]
This will be in String format.
Eg.
String temp = "[a, b, c, d]"
How can I convert this into an ArrayList of String object?
I have the printed value of an ArrayList of Strings.
[a, b, c, d]
This will be in String format.
Eg.
String temp = "[a, b, c, d]"
How can I convert this into an ArrayList of String object?
Very simple code
String temp = "[a, b, c, d]";
// trim enclosing brackets and then split by comma and space
String[] array = temp.substring(1, temp.length() - 1).split(", ");
List<String> list = new ArrayList<String>();
for (String s : array) {
list.add(s);
}