Anonymous user
Copy a string: Difference between revisions
→{{header|Objective-C}}
(F#) |
|||
Line 343:
=={{header|Objective-C}}==
Immutable strings - since they are immutable, you may get the same instance with its references count increased. Or, you can get a copy which is mutable.
<lang objc> NSString *original = @"Literal String";
NSString *new = [original copy];
NSString *newMutable = [original mutableCopy];</lang>
Mutable strings - you can get either new mutable or immutable string:
<lang objc> NSMutableString *original = [NSMutableString stringWithString:@"Literal String"];
NSString *immutable = [original copy];
NSMutableString *mutable = [original mutableCopy];</lang>
|