I am having a String "S".Only Substrings in single quotes must be assigned to a String Array.Its may not be necessary alternate words are in single quotes.
String S = "Username 'user1'
Username2 'user2'
Usermane3 'user3' 'user4'";
It must be assigned as below (only Substrings with single Quotes)
String Username[] ={'user','user1','user2','user4'};
What I tried
String s1 = S.replace(System.getProperty("line.separator"), " ");
//replacing newline with single space
String Username[] = s1.split(" ");
//separating string into sub-string
Username[]={Username,'user1',Username2,'user2',Username3, 'user3','user4'};