1

这是我的茄子脚本

if iFound does not contain "NULL" then
    //replace "\n" by " & return & " in iFound
    replace every occurrence of "\n" in iFound with " & return & "

    log "before clicking see text" && iFound
    log "not null and clicking"
    click iFound
End if

这里我的参数 iFound 持有“Cadbury Creme Egg\nMcFlurry”

我想将“Cadbury Creme Egg\nMcFlurry”替换为“Cadbury Creme Egg & return & McFlurry”

因此我编写了替换命令,但它忽略了转义字符“\n”

replace every occurrence of "\n" in iFound with " & return & "

如何用“& return &”替换“\n”换行符

4

1 回答 1

2

通常,当您在日志窗口或运行窗口中遇到 \n 或 \t 字符时,它实际上已经是 CRLF 或 TAB 字符。\n 用于日志显示,因为多行显示在滚动文本中效果不佳。

如果将该字符串保存到文件中,您应该会看到这两个字符正确通过。

您还可以在 Eggplant --> Preferences --> Run --> Keyboard 菜单下为 IDE 打开转义字符(以便将 \n 解释为与 return 相同)作为“启用反斜杠转义代码”复选框。

于 2016-08-26T17:10:32.800 回答