Menu

#57 "Search and Replace using Blocks" won't work

RegexKitLite 4.0
open
5
2010-12-09
2010-12-09
exalted
No

Example "Search and Replace using Blocks" in RegexKitLite won't work as is:

NSString *searchString = @"This is neat.";
NSString *regexString = @"\\b(\\w+)\\b";
NSString *replacedString = NULL;

replacedString = [searchString stringByReplacingOccurrencesOfRegex:regexString
usingBlock:
^NSString *(NSInteger captureCount,
NSString * const capturedStrings,
const NSRange capturedRanges[captureCount],
volatile BOOL * const stop) {
return([NSString stringWithFormat:@"{%@}",
[capturedStrings[1] capitalizedString]]);
}];

error: incompatible block pointer types initializing 'struct NSString * (^)(NSInteger, struct NSString * const, const struct NSRange *, volatile BOOL * const)', expected 'struct NSString * (^)(NSInteger, struct NSString * const*, const struct NSRange *, volatile BOOL * const)'

Any ideas please? Thanks.

Best regards,

Discussion


Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.