Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

How do I remove double quotes from an NSString. Example:

//theMutableString: "Hello World"

[theMutableString replaceOccurrencesOfString:@""" withString:@"" options:NSCaseInsensitiveSearch range:(NSRange){0,[theMutableString length]}]

It doesn't seem to work, maybe since I had to escape the " in the replaceOccurrencesOfString?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
734 views
Welcome To Ask or Share your Answers For Others

1 Answer

Use the NSMakeRange function instead of your cast. This'll work:

[mString replaceOccurrencesOfString:@""" withString:@"" options:NSCaseInsensitiveSearch range:NSMakeRange(0, [mString length])];

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...