我想在Applescript中替换“\ n”。每当我写下它时,它只会将\n
之后的内容带到下一行。我该怎么做?
set newVar to my replaceText("\n/blah-blah", "")
编辑:
set newVar to my replaceText(linefeed, "", newVar)
log newVar
newVar
仍会以\n
打印到最后。
答案 0 :(得分:9)
找到问题的解决方案,转到首选项 - >编辑并检查字符串中的转义标签和换行符
答案 1 :(得分:8)
这应该抓住他们所有人:
set oldText to "line 1
line 2
line 3"
set AppleScript's text item delimiters to {return & linefeed, return, linefeed, character id 8233, character id 8232}
set newText to text items of oldText
set AppleScript's text item delimiters to {" "}
set newText to newText as text
使用“blah \ n”作为oldText
答案 2 :(得分:2)
使用linefeed
AppleScript constant:
set newVar to my replaceText(linefeed & "/blah-blah", "")