Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
20
Task/String-concatenation/Objective-C/string-concatenation.m
Normal file
20
Task/String-concatenation/Objective-C/string-concatenation.m
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
#import <Foundation/Foundation.h>
|
||||
|
||||
int main()
|
||||
{
|
||||
@autoreleasepool {
|
||||
|
||||
NSString *s = @"hello";
|
||||
printf("%s%s\n", [s UTF8String], " literal");
|
||||
|
||||
NSString *s2 = [s stringByAppendingString:@" literal"];
|
||||
// or, NSString *s2 = [NSString stringWithFormat:@"%@%@", s, @" literal"];
|
||||
puts([s2 UTF8String]);
|
||||
/* or */
|
||||
NSMutableString *s3 = [NSMutableString stringWithString: s];
|
||||
[s3 appendString: @" literal"];
|
||||
puts([s3 UTF8String]);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue