1

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

1 Answer 1

12
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"];
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.