在YAML中,我的字符串很长。我想将其保留在编辑器的80列(或类似视图)内,所以我想破坏字符串。这是什么语法?
换句话说,我有这个:
Key: 'this is my very very very very very very long string'
我想要这个(或达到这种效果的东西):
Key: 'this is my very very very ' +
'long string'
我想使用上述引号,因此不需要在字符串中转义任何内容。
使用yaml折叠样式。每行的缩进将被忽略。一个换行符将插入到末尾。
Key: >
This is a very long sentence
that spans several lines in the YAML
but which will be rendered as a string
with only a single carriage return appended to the end.
http://symfony.com/doc/current/components/yaml/yaml_format.html
您可以使用“块记录指示器”消除尾随换行符,如下所示:
Key: >-
This is a very long sentence
that spans several lines in the YAML
but which will be rendered as a string
with NO carriage returns.
在任何一种情况下,每个换行符都被一个空格代替。
也有其他控制工具可用(例如,用于控制压痕)。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句