Programming Reference/Librarys
Question & Answer
Q&A is closed
- (NSString *)stringByAppendingFormat:(NSString *)format, …
Returns a string made by appending to the receiver a string constructed from a given format string and the following arguments.
for(int a=0; a<5; a++) { NSString *cycle=@"Pass"; cycle=[cycle stringByAppendingFormat:@"%i", a]; NSLog(@"%@", cycle); }
2012-04-15 12:14:53.335 FoundationNSString[649:403] Pass0 2012-04-15 12:14:53.339 FoundationNSString[649:403] Pass1 2012-04-15 12:14:53.340 FoundationNSString[649:403] Pass2 2012-04-15 12:14:53.341 FoundationNSString[649:403] Pass3 2012-04-15 12:14:53.342 FoundationNSString[649:403] Pass4