iphone-common-codes-ccteam源代码 CCNSRegularExpression.m

来源:互联网 发布:苹果ios6系统能用软件 编辑:程序博客网 时间:2024/06/06 20:54
////  CCNSRegularExpression.m//  CCFC////  Created by xichen on 11-12-23.//  Copyright 2011 ccteam. All rights reserved.//#import "CCNSRegularExpression.h"@implementation NSRegularExpression(cc)// get the common result array with pattern in the string: str;// returns the array of "NSTextCheckingResult *" elements.+ (NSArray *)getCommonResult:(NSString *)str withPattern:(NSString *)pattern{        NSRegularExpression *regExp =                 [NSRegularExpression regularExpressionWithPattern:pattern                options:NSRegularExpressionCaseInsensitive error:nil];        NSArray * arr = [regExp matchesInString:str                                                                        options:NSMatchingCompleted                                                                          range:NSMakeRange(0, [str length])];        return arr;}@end////  CCNSRegularExpression.m//  CCFC////  Created by xichen on 11-12-23.//  Copyright 2011 ccteam. All rights reserved.//#import "CCNSRegularExpression.h"@implementation NSRegularExpression(cc)// get the common result array with pattern in the string: str;// returns the array of "NSTextCheckingResult *" elements.+ (NSArray *)getCommonResult:(NSString *)str withPattern:(NSString *)pattern{        NSRegularExpression *regExp =                 [NSRegularExpression regularExpressionWithPattern:pattern                options:NSRegularExpressionCaseInsensitive error:nil];        NSArray * arr = [regExp matchesInString:str                                                                        options:NSMatchingCompleted                                                                          range:NSMakeRange(0, [str length])];        return arr;}@end


可能有更新:

googlecode链接地址:http://code.google.com/p/iphone-common-codes-ccteam/source/browse/trunk/CCFC/files/CCNSRegularExpression.m

github地址: https://github.com/cxsjabc/iphone-common-codes-ccteam/tree/master/CCFC/files/CCNSRegularExpression.m


原创粉丝点击