[英]Empty field in yaml
我想在我的 .yaml 字段中留空一个值,因为在另一个翻译中必须有一些东西,但不是这个。 只需将其留空即可打印出值的路径 (...title.3)。
title:
1: String
2: String2
3:
如果你想要一个空字符串,而不是一个空值,你可以使用两个单引号。
title:
1: String
2: String2
3: ''
根据YAML v1.2 规范:
10.3.2. 标签解析
Regular expression Resolved to tag null | Null | NULL | ~ tag:yaml.org,2002:null /* Empty */ tag:yaml.org,2002:null
因此,放置null
或~
或省略值会产生相同的结果: tag:yaml.org,2002:null
:
parent:
key1: # empty so "null", # is a comment!
key2: ~ # also "null"
key3: null # "null" explicitly ))
key4: !!null "null" # for the funs of "secondary tag handle: !!"
key5: "null" # sorry, it is a string or !!str if you like ((
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.