0

I have a string of names. I am looking to split it based on names between double quotes. I used the following code to split the names.

String []splitterString=str.split("\"");

for (String s : splitterString) {
    System.out.println(s);
}

I get the output as:

[
Hossain, Ziaul
,
Sathiaseelan, Arjuna
,
Secchi, Raffaello
,
Fairhurst, Gorry
]

I need to store just the names from these. I am not sure how to do that.

This is the string: ["Hossain, Ziaul","Sathiaseelan, Arjuna","Secchi, Raffaello","Fairhurst, Gorry"]

Thanks for the help!!!

Mangu Singh Rajpurohit
  • 10,806
  • 4
  • 68
  • 97
Josephine
  • 77
  • 2
  • 11

1 Answers1

1

I think following solution may help you out :-

String str = "[\"Hossain, Ziaul\",\"Sathiaseelan, Arjuna\",\"Secchi, Raffaello\",\"Fairhurst, Gorry\"]";


String [] str1 = str.split("\\[\"|\",\"|\"\\]");
for (int iCount = 0; iCount < str1.length; iCount++)
{
   System.out.println(str1[iCount]);
}
Mangu Singh Rajpurohit
  • 10,806
  • 4
  • 68
  • 97