So, perhaps everyone else in the universe just learned this automatically, but for some reason, it took quite a bit of hunting to find it. Anyway, if you pass around a bunch of NSString's and want to use them in NSString's stringWithFormat, the character sequence to use is %@. In other words, you can do the following:
NSString* string1 = @"Jon";
NSString* formattedString = [NSString stringWithFormat:@"Hello %@"];
Which of course will insert "Jon" into the other NSString. All the other C formatting escape sequences will also work such as %d, etc, etc.
Anyway, hopefully this helps someone. If nothing else, I can just return to my own blog the next time I forget!
-Jon
|