Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想知道如何使用 Ruby here-document 保留连续的换行符?在我的程序中,所有这些都折叠为一个换行符。例如:
s=<<END 1 2 3 4 END
评估为:
s="1\n2\n3\n4\n"
但是,例如在将 BBcode 文档格式化为字母或类似内容时,我想保留连续的换行符。
这对我来说就像一个错误。你试过多线%q吗?
%q
s=%q(1 2 3 4 )