i am getting text like :-
1. e4 e5 2. Nf3 Nc6 3. Bb5 {This opening is called the Ruy Lopez.} 3... a6
4. Ba4 Nf6 5. O-O Be7 6. Re1 b5 7. Bb3 d6 8. c3 O-O 9. h3 Nb8 10. d4 Nbd7
11. c4 c6 12. cxb5 axb5 13. Nc3 Bb7 14. Bg5 b4 15. Nb1 h6 16. Bh4 c5
I need to remove {the comment inside the } but before that i need to copy it along with the index number of the move like with 3 or with Bb5.
inorder to remove the string i am using
- (NSString *)stringFilter:(NSString *)targetString {
NSScanner *theScanner;
NSString *text = nil;
theScanner = [NSScanner scannerWithString: targetString];
while ([theScanner isAtEnd] == NO) {
[theScanner scanUpToString:@"{" intoString:NULL] ;
[theScanner scanUpToString:@"}" intoString:&text] ;
targetString = [targetString stringByReplacingOccurrencesOfString:
[NSString stringWithFormat:@"%@}", text]
withString:@""];
}
return targetString;
}
I am looking for how can i copy that string and store it in dictionary or array thanks.
I use the following category method to get the contents between ‘(‘ & ‘)’. You can adapt it easily…
EDIT: Full category for completeness