Alex Rivera | Logout

How to append a NSString onto another NSString

Asked 2012-07-03T09:47:57.813
29

I am relatively new in Objective C but not with programming. I was wondering how you can append one NSString onto another. I am making an app in which a user has to finish a basic sentence, and I was wondering how to get the string the user entered and append it onto the current one that is on the screen?

Edit
Report

1 Answer

14

It looks like you have your answer but you can also use the stringWithFormat: method like so:

NSString *sample1 = @"Hello"; 
NSString *sample2 = @"Being appended";

NSString *complete = [NSString stringWithFormat:@"%@%@", sample1,
sample2];
answered 2013-01-08T15:16:46.780

Your Answer