简体   繁体   English

如何在ttl语言中使用crlf生成字符串变量

[英]How to generate string variable with crlf at ttl language

I'm trying to make string that contain crlf inside it at ttl language.我正在尝试在 ttl 语言中创建包含 crlf 的字符串。 For example, somthing such as:例如,诸如此类的东西:

MY_STRING = "hello\nworld"
send  MY_STRING

should result as结果应为

hello
world

I know I can get the same with:我知道我可以得到相同的结果:

send "hello" #13#10 "world"

but I need it as string because I want to 'send' this string to another 'function', for example:但我需要它作为字符串,因为我想将此字符串“发送”到另一个“函数”,例如:

MY_STRING = "hello\nworld"
include "printMyString.ttl"

I tried something like:我试过类似的东西:

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"

but it didn't worked, is there is a way?但它没有用,有什么办法吗?

I found some way, maybe there is better:我找到了一些方法,也许有更好的方法:

code2str CRLF $0d0a
sprintf2 MY_STRING "%s%s%s" "hello" CRLF "world"
send  MY_STRING

EDIT It comes out that my first approach was good, just didn't understand that #13 is string:编辑结果表明我的第一种方法很好,只是不明白#13 是字符串:

sprintf2 MY_STRING "%s%s%s%s" "hello" #13 #10 "world"
send  MY_STRING

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM