0

我正在使用以下方式连接两个字符串

    NSString *firstString =@"Added Contnet To My Learning";
NSString *secondString = appDelegate.activity_Description;
appDelegate.activity_Description = [firstString stringByAppendingString:secondString];
4

3 回答 3

2

你可以这样做。

NSString *firstString =@"Added Contnet To My Learning";
NSString *secondString = appDelegate.activity_Description;
appDelegate.activity_Description = [NSString stringWithFormat:@"%@ %@", firstString, secondString];
于 2013-03-22T11:04:02.650 回答
0

你试过了吗?

 NSString *firstString =@"Added Contnet To My Learning ";
 // a space after the first string
于 2013-03-22T11:03:07.300 回答
0

这是你可以用字符串做的所有方法

//1st Way
NSString *finalString = [NSString stringWithFormat:@"%@ %@",firstString,secondString];

//2nd Way
NSString *finalString = [firstString stringByAppendingFormat:@" %@",secondString];

//3rd way
NSArray *ary= [NSArray arrayWithObjects:firstString,secondString, nil];
NSString *finalString= [ary componentsJoinedByString:@" "];  

按照这个如何在iphone中连接两个字符串

于 2013-03-22T11:33:30.000 回答