+[NSString stringWithString:] -- what's the point?
cocoa, cocoa-touch, nsstring, objective-c
Solution
You might have a NSMutableString (or some home-grown NSString subclass) that you want to duplicate.
NSMutableString *buffer = [NSMutableString string];
// do something with buffer
NSString *immutableStringToKeepAround = [NSString stringWithString:buffer];
Of course, you can also just make a copy:
NSMutableString *buffer = [NSMutableString string];
// do something with buffer
NSString *immutableStringToKeepAround = [[buffer copy] autorelease];
but you own the copy and must release or autorelease it.
Problem
As `NSString` strings are immutable, what is the value of the `stringWithString:` class method? I get the utility when used with `NSMutableString`, I just didn't see the utility with the `NSString` class.