Table of Contents

stringByAppendingString

    -(NSString *)stringByAppendingString:(NSString *)aString;    

Returns a new string made by appending a given string to the receiver.

ObjC Sourcecode Example

  NSString *cycle=@"Pass";
 
        for(int a=0; a<5; a++)
        {
 
            NSString *intValue=[NSString stringWithFormat:@"%i", a];
 
            cycle=[cycle stringByAppendingString:intValue];
 
            NSLog(@"%@", cycle);
 
        }

Output for this example code

output:

 
2012-04-15 12:08:02.994 FoundationNSString[633:403] Pass0
2012-04-15 12:08:02.998 FoundationNSString[633:403] Pass01
2012-04-15 12:08:02.998 FoundationNSString[633:403] Pass012
2012-04-15 12:08:03.000 FoundationNSString[633:403] Pass0123
2012-04-15 12:08:03.001 FoundationNSString[633:403] Pass01234