如何在AppleScript中替换"\n"?

Ava*_*Ava 4 macos applescript

我想在Applescript中替换"\n".每当我写下它时,它只会将后面的内容\n带到下一行.我怎么做?

set newVar to my replaceText("\n/blah-blah", "")
Run Code Online (Sandbox Code Playgroud)

编辑:

set newVar to my replaceText(linefeed, "", newVar)
log newVar
Run Code Online (Sandbox Code Playgroud)

newVar仍然打印\n到最后.

dou*_*arp 9

找到问题的解决方案,转到首选项 - >编辑并检查字符串中的转义选项卡和换行符

http://forums.macrumors.com/showthread.php?t=1395073


ada*_*one 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
Run Code Online (Sandbox Code Playgroud)

使用"blah \n"作为oldText在此输入图像描述