Julia 中的原始文字字符串 [英] Raw literal strings in Julia
问题描述
在 Python 中,可以编写 r"a
b"
以防止
被解释为换行符的转义序列.
In Python one can write r"a
b"
in order to prevent the
from being interpreted as an escape sequence for newline.
在 Julia 中有类似的东西吗?而像"$variable"
这样的字符串插值呢,有没有办法防止呢?
Is there something similar in Julia? And what about string interpolation like "$variable"
, is there a way to prevent it?
我知道在 Julia 中可以简单地编写 "a\nb"
和 "$variable"
,但我想编写很多 LaTeX 字符串必须注意正确转义每个反斜杠 和美元
$
字符...
I know one can simply write "a\nb"
and "$variable"
in Julia, but I would like to write a lot of LaTeX strings without having to care to proper escape every backslash and dollar
$
characters...
(在 Julia 中,r"..."
创建一个正则表达式.)
(In Julia, r"..."
creates a regular expression.)
推荐答案
来自 Julia 0.6 我们有 raw"a$variable"
这篇关于Julia 中的原始文字字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!