如何在 YAML 中进行字符串连接或字符串替换? [英] How can I do string concatenation, or string replacement in YAML?
本文介绍了如何在 YAML 中进行字符串连接或字符串替换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个:
user_dir: /home/user
user_pics: /home/user/pics
我如何将 user_dir
用于 user_pics?如果我必须像这样指定其他属性,它不会很干.
How could I use the user_dir
for user_pics? If I have to specify other properties like this, it would not be very DRY.
推荐答案
可以使用重复节点,像这样:
You can use a repeated node, like this:
user_dir: &user_home /home/user
user_pics: *user_home
我不认为你可以连接,所以这不会工作:
I don't think you can concatenate though, so this wouldn't work:
user_dir: &user_home /home/user
user_pics: *user_home/pics
这篇关于如何在 YAML 中进行字符串连接或字符串替换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文