我將Safari中的Objective-C示例剪切並粘貼到Xcode中,但格式會變得混亂。我知道我可以爲{和\ r進行多次查找和替換,但是在某處是否有一個按鈕修復? Xcode選項/插件。 TextEdit插件等?格式化Objective-C代碼
答:我創建了一個AppleScript中的TextWrangler
tell application "TextWrangler"
activate
replace "- (" using "\\r- (" searching in text 1 of text document "untitled text" options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
select find window
select text 1 of find window
replace ";" using ";\\r" searching in text 1 of text document "untitled text" options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
select find window
replace "{" using "{\\r" searching in text 1 of text document "untitled text" options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
select find window
replace "//" using "\\r//" searching in text 1 of text document "untitled text" options {search mode:literal, starting at top:true, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:false}
end tell
我用的TextWrangler它有選項來記錄一個蘋果,然後找到/替換後添加\ r};和 - ( –