I get an NSString containing different emails concatenated together like
def_ghi@hotmail.com_abc_1@me.com
Each email is separated by an underscore.The problem is if I try to separate the string using the underscore character it would also subdivide a single e-mail address as an underscore character can also come in within a single e-mail. What I've tried gives me this result
def
ghi@hotmail.com
abc
1@me.com
Here is my code
NSString *string = //The string I am receiving.
NSArray *chunks = [string componentsSeparatedByString: @"_"];
Please help me.
EDIT: I asked a senior and he told me that I should first search the string for "@" character.When I find this,then I search for an "_" and replace it if it exists.As the first underscore after "@" is the separator.I should then start from this location and again repeat the previous step.I do this till the string ends.Please somebody help me with this.