ios NSString 截取汉字 数字 字母

字符串截取:

删除字符串中的字母+汉字

NSString *string = @"bushi1222真正90-快乐";

NSRegularExpression *regular = [NSRegularExpression regularExpressionWithPattern:@"[a-zA-Zu4e00-u9fa5]+" options:0 error:NULL];

result = [regular stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];

result 即为截取后的结果。

字符串替换:

result = [result stringByReplacingOccurrencesOfString:@"(null)" withString:@""];

 

原文地址:https://www.cnblogs.com/blogfantasy/p/5532225.html