问题描述
我正在尝试使用ttl语言制作包含crlf的字符串。例如:
MY_STRING = "hello\nworld"
send MY_STRING
应为
hello
world
我知道我可以通过以下方式获得相同的体验
send "hello" #13#10 "world"
但是我需要它作为字符串,因为我想将此字符串“发送”到另一个“函数”,例如:
MY_STRING = "hello\nworld"
include "printMyString.ttl"
我尝试过类似的事情:
sprintf2 MY_STRING "%s\n%s" "hello" "world"
sprintf2 MY_STRING "%s%d%d%s" "hello" 13 10 "world"
sprintf2 MY_STRING "%s%d%d%s" "hello" #13 #10 "world"
但是它没有用,有办法吗?
解决方法
我找到了某种方法,也许有更好的方法:
code2str CRLF $0d0a
sprintf2 MY_STRING "%s%s%s" "hello" CRLF "world"
send MY_STRING
编辑 结果表明,我的第一种方法很好,只是不了解#13是字符串:
sprintf2 MY_STRING "%s%s%s%s" "hello" #13 #10 "world"
send MY_STRING