字符串截取:
删除字符串中的字母+汉字
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:@""];