開發(fā)過程中使用到的正則表達(dá)式

全局正則替換添加一句代碼
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)
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容