字符串截取:
刪除字符串中的字母+漢字
NSString *string = @"你bushi1222真正90-快樂";
NSRegularExpression *regular = [NSRegularExpression regularExpressionWithPattern:@"[a-zA-Z\u4e00-\u9fa5]+" options:0 error:NULL];
result = [regular stringByReplacingMatchesInString:string options:0 range:NSMakeRange(0, [string length]) withTemplate:@""];
result 即為截取后的結果。
字符串替換:
result = [result stringByReplacingOccurrencesOfString:@"(null)" withString:@""];