Vaibhav Jhaveri Vaibhav Jhaveri -4 years ago 91
iOS Question

Fetch Substring from NSString

I have the following string :

Item 1#Item 2#Item 3#Item 4#Item 5#Item 6#Item 7#Item 8#Item 9#Item 10#Item 11#Item 12#Item 13#Item 14#Item 15#


I want to extract each Item name. How can it be done?

Answer Source

try this

NSString *temp = @"Item 1#Item 2#Item 3#Item 4#Item 5#Item 6#Item 7#Item 8#Item 9#Item 10#Item 11#Item 12#Item 13#Item 14#Item 15#";
    NSArray *arr = [temp componentsSeparatedByString:@" "];
    NSLog(@"%@", arr);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download