NSPredicate中国語対応

3839 ワード

iOSでは、NSPredicateの文字列比較機能を使用して、MATCHESという を います.

, 6-15 / , NSPredicate :

    

NSString * regex        = @"(^[A-Za-z0-9]{6,15}$)";

NSPredicate * pred      = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regex];

BOOL isMatch            = [pred evaluateWithObject:@"123456ABCde"];


iOS NSPredicate 。 :

NSPredicate :
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html

Predicate format strings:
http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pSyntax.html

ICU :
http://www.icu-project.org/userguide/regexp.html