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

4

1 回答 1

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

于 2012-10-24T17:19:46.453 回答