Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
给定一个数组
$values = ['a', 'b', 'c']
我如何获得的索引'c'?
'c'
在 puppetstdlib中,它带有一个函数名values_at。这与您正在寻找的完全相反。通过查看例如,您可以逆转此过程并轻松创建自己的功能/etc/puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb。
stdlib
values_at
/etc/puppet/modules/stdlib/lib/puppet/parser/functions/values_at.rb