I need to replace the standard upper double quotes "" that already exist (in the text I get from the database), with specific quotes for German text for use in UIWebView. The first double-quote character before the quoted word (s) (each even index) must be replaced by the HTML equivalent "which is „ and the second after the quoted word (s) (each odd index) which is “ ;. The quotation marks can be anywhere text, so I cannot rely on any fixed positions.
So basically I have NSString:
just "some" text with the text "more"
or Objective-C:
NSString *str = @"just \"some\" text with some \"more\" text";
I am aware of the stringByReplacingOccurrencesOfString method from NSString, but of course this replaces all double quotes with a lower double quotation mark.
NSString *newStr = [str stringByReplacingOccurrencesOfString:@"\"" withString:@"„"];
I could not find a way to simply replace every second or every nth case, does anyone have a clue / idea, how could I do this?
thanks a lot
source share