多行字符串作为序列的一部分 [英] Multi-line string as part of sequence

查看:28
本文介绍了多行字符串作为序列的一部分的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道如何使用多行字符串作为 yaml 序列的一部分:

I can't figure out how to use a multi-line string as part of a yaml sequence:

foo:
  - bar
  - bar2
  - > super duper long
 string that I would like
 to have on multiple lines
  - Another item

有可能吗?

推荐答案

如果你想使用折叠标量:

If you want to use a folded scalar:

foo:
  - bar
  - bar2
  - >
     super duper long
     string that I would like
     to have on multiple lines
  - Another item

请注意,折叠标量的标头行(带有 > 的行)上可能没有内容.

Note that there may not be content on the line of the folded scalar's header (the line with the >).

或者,您可以只使用普通标量:

Alternatively, you can just use a plain scalar:

foo:
  - bar
  - bar2
  - super duper long
    string that I would like
    to have on multiple lines
  - Another item

这篇关于多行字符串作为序列的一部分的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆