4

Possible Duplicate:
How do I concatenate strings in Objective-C?

Hello everyone I am new to Objc, I want to concatenate strings of the Integer value with string value. Here is my code:

[runtime setText:[NSString stringWithFormat:@"%@",self.movie.runtime]];

The result will be: 120

The result that I wish to concatenate string is: 120 Minutes.

Please share me about this. Thanks

Community
  • 1
  • 1
Siden Em
  • 59
  • 1
  • 3
  • 1
    You should search the website before posting. I would suggest reading this question which can help you with your problem: http://stackoverflow.com/questions/510269/how-do-i-concatenate-strings-in-objective-c – Shubhanshu Mishra Oct 24 '12 at 17:37

1 Answers1

6

I guess, you want this

[runtime setText:[NSString stringWithFormat:@"%@ Minutes",self.movie.runtime]];

while concatenating would be:

NSString *newString = [aString stringByAppendingString:anotherString];

for immutable NSStrings

and

[aMuteableString appendString:anotherString];

for NSMutableStrings

vikingosegundo
  • 51,126
  • 14
  • 131
  • 172