美文网首页
开发过程中使用到的正则表达式

开发过程中使用到的正则表达式

作者: CAICAI0 | 来源:发表于2019-10-30 15:34 被阅读0次

全局正则替换添加一句代码
OC

code
     [self.viewController presentViewController:alertController animated:YES completion:nil];

正则:([\s]*)\[([\S]+)[\s]+presentViewController[\s]*:[\s]*([\S]+)[\s]+animated[\s]*:[\s]*([\S]+)[\s]+completion[\s]*:[\s]*([\S]+)[\s]*\]
替换:$1$3.modalPresentationStyle = UIModalPresentationFullScreen;$1[$2 presentViewController:$3 animated:$4 completion:$5]

code
    alertController.modalPresentationStyle = UIModalPresentationFullScreen; 
    [self.viewController presentViewController:alertController animated:YES completion:nil];

swift

let reader = nv.viewControllers.first as? JKJReaderController {
reader.docId = news.document.docId
nv.modalPresentationStyle = .fullScreen;
from.present(nv ,animated: true,completion: nil)

正则:([\s]*)([\S]*)present[\s]*\([\s]*([\S]+)[\s]*,[\s]*animated[\s]*:[\s]*([\S]+)[\s]*,[\s]*completion[\s]*:[\s]*([\S]+)[\s]*\)
替换:$1$3.modalPresentationStyle = .fullScreen $1$2present($3 ,animated: $4,completion: $5)

let reader = nv.viewControllers.first as? JKJReaderController {
reader.docId = news.document.docId
nv.modalPresentationStyle = .fullScreen 
from.present(nv ,animated: true,completion: nil)

相关文章

网友评论

      本文标题:开发过程中使用到的正则表达式

      本文链接:https://www.haomeiwen.com/subject/obgovctx.html