Breaking News
Home / iOS / iOS Snippets / How to split a delimited NSString into a NSArray ?

How to split a delimited NSString into a NSArray ?

Answer

Splitting a NSString delimited by any character like comma, space, hash etc. into a NSArray can be done by calling componentsSeparatedByString method on the NSString as shown in below.

  1.     NSString *termString = @"A,B,C,D,E";
  2.     NSArray *terms  = [termString componentsSeparatedByString:@","];
  3.     NSLog(@"Terms array %@",terms);
[pb_builder]

Check Also

EKCalendar – That account does not allow calendars to be added or removed

Usecase When I am trying to create a new Calendar programmatically using the EventKit API …

Advertisment ad adsense adlogger