Questions tagged [stringwithstring]
3 questions
17
votes
3 answers
Obj-C: [NSString stringWithString:@"string"] vs. @"string"
I've seen people do something like [NSString stringWithString:@"some string"]. Why not just do @"some string"?
For an example, look at the facebook-ios-sdk.
+[NSString stringWithString:] -- what's the point? is a similar question, but none of the…

ma11hew28
- 121,420
- 116
- 450
- 651
4
votes
2 answers
Objective C stringWithFormat if statement
I'm pretty new to this - I'm trying to compare a NSString stringWithFormat with some text. It works fine with stringWithString. I can't work out why it doesn't work with stringWithFormat?
Many thanks for any help anyone can offer!
NSString…

David
- 43
- 3
4
votes
2 answers
XCode Warning: Using 'stringWithString': with a literal is redundant
I got the following warning
Using 'stringWithString': with a literal is redundant
while using the method usingWithString
[NSString stringWithString:@"Content-Type: content/unknown\r\n\r\n"]

Jun
- 3,422
- 3
- 28
- 58