-3

How convert following String with string values to List<String>:

[null,294,160,199,105] 
Nicolas Filotto
  • 43,537
  • 11
  • 94
  • 122
Jefrey Piekny
  • 88
  • 4
  • 11

3 Answers3

5

Here is a simple way to do it:

List<String> result = Arrays.asList(
    input.substring(1, input.length() - 1).split(",")
);
Nicolas Filotto
  • 43,537
  • 11
  • 94
  • 122
1

I'm not sure but you can try this one...

List<String> lst = new ArrayList<String>();
for (String field : inputStr.split(","))
    lst.add(field);
roottraveller
  • 7,942
  • 7
  • 60
  • 65
  • 1
    Arrays.asList(str.split(",")); remove first and last chars from the string (the [ and ]) before splitting – Tokazio Sep 26 '16 at 11:00
0

I would suggest to take a look at the following API:

You should find there enough information to solve this on your own.

Alexander
  • 1,356
  • 9
  • 16