views:

47

answers:

1

How do I concenate 2 strings in objective-c, like in VB.net you can just do "foo" & "bar"

+6  A: 
NSString *newString = [@"foo" stringByAppendingString:@"bar"];

If you're going to change your string frequently consider using its mutable variant - NSMutableString which allows to append strings without creating new instance:

NSMutableString *mutString = [NSMutableString stringWithString:@"foo"];
[mutString appendString:@"bar"];
Vladimir