i have a string like this nsstring *mystring=@"RahulVyas"; now i want to add this ' so the new string would be 'RahulVyas'
any way to do this?
i have a string like this nsstring *mystring=@"RahulVyas"; now i want to add this ' so the new string would be 'RahulVyas'
any way to do this?
How about:
NSString *newString = [NSString stringWithFormat:@"'%@'", mystring];
You just want to surround the string with single quotes, right? You can just use stringWithFormat:
mystring = [NSString stringWithFormat:@"'%@'", mystring];
NSString *mystring=@"'RahulVyas'";
NSLog(@"%@", mystring);
Seems to work just fine for me.