【发布时间】:2013-10-25 14:14:13
【问题描述】:
我是 Objective-c 的初学者。
我有以下NSMutableString stringVal=@"[abc][test][end]";
为了删除最后一个 [] 片段(例如 [end]),我应该使用什么最佳方法?
我有这个代码:
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:@"\[]" options:0 error:NULL];
NSArray *matches = [regex matchesInString:stringVal options:0 range:NSMakeRange(0, [stringVal length])];
for (NSTextCheckingResult *match in matches) {
?? what should i do here?
}
【问题讨论】:
-
好的,我的理解是你想删除字符串结尾,然后你想在你的数组上添加对吗??
标签: objective-c nsregularexpression nsmutablestring