我使用以下方式连接两个字符串我希望添加内容到我的学习之间的空间和第二个字符串任何想法如何给予空间感谢
NSString *firstString =@"Added Contnet To My Learning";
NSString *secondString = appDelegate.activity_Description;
appDelegate.activity_Description = [firstString stringByAppendingString:secondString];
答案 0 :(得分:2)
你可以这样做。
NSString *firstString =@"Added Contnet To My Learning";
NSString *secondString = appDelegate.activity_Description;
appDelegate.activity_Description = [NSString stringWithFormat:@"%@ %@", firstString, secondString];
答案 1 :(得分:0)
你试过吗?
NSString *firstString =@"Added Contnet To My Learning ";
// a space after the first string
答案 2 :(得分: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:@" "];