implode function


/ Published in: Objective C
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.