正则替换特定字符

 let url = "http://image.xxxx.xxx/xxxx/xxxx/xxxxx.jpg@xxx.webp"
 do
 {
         let expression = try NSRegularExpression(pattern: "@\\w+.webp", options: [])
          let newUrl = expression.stringByReplacingMatches(in: url, options: [], range: NSMakeRange(0, url.characters.count), withTemplate: "")
          mImageNode?.url = URL(string: newUrl)
 }
 catch
 {

 }

说点什么

avatar
  Subscribe  
提醒