在過去的幾天(幾周,幾個月,幾年,如果你算我的一次又一次的搜索和嘗試)我一直在努力或找到一個正則表達式過濾器可以幫助我刪除在我的代碼中找到的所有多餘的括號。需要幫助,使RegExp過濾器,以取代冗餘括號
附加了正則表達式過濾器必須處理的最壞情況。由於是最好的情況下
回報((((((((((((((((((((((((((getHumanReadableLine( 「avHardwareDisable」)+ getHumanReadableLine(「hasAccessibility 「))+ getHumanReadableLine(」hasAudio「))+ getHumanReadableLine(」hasAudioEncoder「))+ getHumanReadableLine(」hasEmbeddedVideo「))+ getHumanReadableLine(」hasIME「))+ getHumanReadableLine(」hasMP3「))+ getHumanReadableLine(」hasPrinting「)) )+ getHumanReadableLine(「hasStreamingVideo」))+ getHumanReadableLine(「hasTLS」))+ getHumanReadableLine(「hasVideoEncoder」))+ getHumanReadableLine(「hasScreenBroadcast」))+ getHumanReadableLine(「hasScreenPlayback」))+ getHumanReadableLine getHumanReadableLine(「isDebugger」))+ getHumanReadableLine(「language」))+ getHumanReadableLine(「localFileReadDisable」))+ getHumanReadableLine(「manufacturer」))+ getHumanReadableLine(「o ())+ getHumanReadableLine(「screenResolutionX」))+ getHumanReadableLine(「screenResolutionY」)+ getHumanReadableLine(「pixelAspectRatio」))+ getHumanReadableLine(「playerType」))+ getHumanReadableLine(「screenColor」)) ))+ getHumanReadableLine(「version」)));
return(((((name +「:」)+ Capabilities [name])+「\ n」));
正如你所看到的......有一些......我的代碼中有多餘的括號。一直在積極與這些工作很長一段時間,但一直試圖清理我遇到的並試圖找到一個更快的方式來做到這一點。
因此,「乾淨」代碼看起來如何的一個例子,我希望至少!
return(name +「:」+ Capabilities [name] +「\ n」);
return name +「:」+ Capabilities [name] +「\ n」;
任一個是可以接受的,只要完全誠實的代碼本身不嘲笑和更改它是如何工作的。
我非常感謝任何人可以給我的答案。請不要模擬我所做或想要實現的目標。我沒有太多的工作與正則表達式或之前類似的事情......
而只是爲了幽默,你......這裏是我的「正規」我的「乾淨」的例子
(返程)({1 ,}(([^)] {1,}))({1,}))({1,})){1,}
$ 1 $ 2 $ 3 $ 4 //輸出
oh ...忘了提及
(!(testCrossZ()))
可能會出現有時,但這些都不是一個手動清理的問題,如果需要的話。
P.S ...有很多冗餘括號出現......很可能有成千上萬...最有可能是成千上萬。
這是一個不適用於動作腳本的java過濾器... – Kithi
我很肯定IntelliJ在Actionscript代碼中查看它時顯示不必要的括號,如果你沒有禁用檢查。我認爲有一種方法可以針對整個文件發生的問題調用修復程序,如果不是該項目的話。我會盡快檢查並提供更多信息。 (您使用的是哪個版本的IntelliJ?) – karfau