I\'m working through the Stanford iPhone podcasts and have some basic questions.
The first: why is there no easy string concatenation? (or am I just missing it?)
You can use NSString +stringWithFormat to do concatenation:
NSString* a = // ... NSString* b = // ... NSString* a_concatenated_with_b = [NSString stringWithFormat:@"%@%@",a,b];
The reason for the "%@" is that the string formatting is based off of and extends the printf format strings syntax. These functions take a variable number of arguments, and anything beginning with a percent sign (%) is interpreted as a place holder. The subsequent characters determine the type of the place holder. The standard printf does not use "%@", and since "@" is the symbol commonly used for things that Objective-C adds to the C language, it makes sense that the "@" would symbolize "an Objective-C object".
There is no automatic concatentation using the plus sign (+), because NSString* is a pointer type, and Objective-C is a strict superset of C, and so, consequently, adding to an NSString* object does pointer manipulation. Objective-C does not have any operator overloading feature as in the C++ language.