Video Tutorial: NSString

Ray Wenderlich


Your challenge is to write some code that generates Elmo’s song [video] [lyrics], given an arbitrary list of pipe-separated names, like this:

NSString *namesList = @"Elmo|Big Bird|Snuffy";
NSMutableString *finalSong = [NSMutableString string];
// Your code here!
NSLog(@"%@", finalSong);


  • You will probably need to use appendString:, appendFormat:, and componentsSeparatedByString: to accomplish this.
  • Notice there are is a slight variance between verses – the first time it’s “He loves to sing”, the rest is “I love to sing.”
  • Notice the ending also varies depending on whether it’s the first, middle, or final person.

Download demo code

Download challenge solution

Helpful links

Ray Wenderlich

Ray is part of a great team - the team, a group of over 100 developers and editors from across the world. He and the rest of the team are passionate both about making apps and teaching others the techniques to make them.

When Ray’s not programming, he’s probably playing video games, role playing games, or board games.

Other Items of Interest Weekly

Sign up to receive the latest tutorials from each week, and receive a free epic-length tutorial as a bonus!

Advertise with Us!

PragmaConf 2016 Come check out Alt U

Our Books

Our Team

Video Team

... 26 total!

iOS Team

... 80 total!

Android Team

... 35 total!

Unity Team

... 16 total!

Articles Team

... 4 total!

Resident Authors Team

... 29 total!

Podcast Team

... 7 total!

Recruitment Team

... 9 total!