有没有办法表示在 YAML 文档中的多行上没有任何空格的长字符串? [英] Is there a way to represent a long string that doesnt have any whitespace on multiple lines in a YAML document?

查看:30
本文介绍了有没有办法表示在 YAML 文档中的多行上没有任何空格的长字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我有以下字符串:

"abcdefghijklmnopqrstuvwxyz"

而且我认为我的 YAML 文件中的一行太长了,有什么方法可以将其拆分为多行吗?

And I think its too long for one line in my YAML file, is there some way to split that over several lines?

>-
    abcdefghi
    jklmnopqr
    stuvwxyz

将导致 "abcdefghi jklmnopqr stuvwxyz" 很接近,但它不应该有任何空格.

Would result in "abcdefghi jklmnopqr stuvwxyz" which is close, but it shouldn't have any spaces.

推荐答案

使用双引号,并避免换行:

Use double-quotes, and escape the newline:

"abcdefghi\
jklmnopqr\
stuvwxyz"

这篇关于有没有办法表示在 YAML 文档中的多行上没有任何空格的长字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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