Posted By

ibob on 02/07/13


Tagged


Versions (?)

implode function


 / Published in: Objective C
 

  1. NSString* implode(NSString *glue, NSArray *parts){
  2. return [parts componentsJoinedByString:glue];
  3. }
  4.  
  5. //Example:
  6. NSArray *arr = [ [ NSArray alloc ] initWithObjects:@"obj1",@"obj2",@"obj3",@"obj4", nil ];
  7. NSString *joinedstring = implode(@", ", arr);
  8. //Result: "One, Two, Three"

Report this snippet  

You need to login to post a comment.