我将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};和 - ( –