字符串截取:

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

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:@""];

 

相关文章:

  • 2021-08-06
  • 2021-10-12
  • 2022-01-18
  • 2021-11-26
  • 2021-08-22
  • 2021-09-10
  • 2021-06-21
猜你喜欢
  • 2021-06-16
  • 2022-12-23
  • 2022-12-23
  • 2021-10-14
  • 2022-12-23
  • 2021-08-04
相关资源
相似解决方案