Reputation: 28730
I have a NSString like this
NSString *mystring = @"RahulVyas";
Now I want to add this ' so the new string would be 'RahulVyas'
How to do this ?
Upvotes: 1
Views: 4120
Reputation: 572
NSString *mystring=@"'RahulVyas'";
NSLog(@"%@", mystring);
Seems to work just fine for me.
Upvotes: 0
Reputation: 40515
You just want to surround the string with single quotes, right? You can just use stringWithFormat:
mystring = [NSString stringWithFormat:@"'%@'", mystring];
Upvotes: 0
Reputation: 59307
How about:
NSString *newString = [NSString stringWithFormat:@"'%@'", mystring];
Upvotes: 6