I have array of element like this
"Cosmetics~Sample~test1",
"Cosmetics~Sample~test2",
i need to display like this
cosmetics –sample –> test1,test2 (its like cosmetics as main and cosmetics sub will be Sample and Sample sub have test1 and test2 element) like branch
NSArray * seperate=[[NSArray alloc]init];
for (int i =0; i < jsonarray.count; i++) {
NSString *sam=[[jsonarray valueForKey:@"category"]objectAtIndex:i];
seperate=[sam componentsSeparatedByString:@"~"];
[cellarray addObject:[seperate objectAtIndex:0]];
}
I have done separating those with ~ mark but i cant compare those and form like i mentioned.. Help Pls…
Mergertwoarraywithout duplication maintaing order like this: