如何从属性文件中的数组访问元素?
testKey = word1,word2,word3
像这样的东西不起作用(假设属性文件映射到“msg”
#{msg.testKey[0]} <- to access first element
如何从属性文件中的数组访问元素?
testKey = word1,word2,word3
像这样的东西不起作用(假设属性文件映射到“msg”
#{msg.testKey[0]} <- to access first element
这是一个String
,不是一个String[]
。您必须先用逗号将其拆分fn:split()
为 a String[]
,以便您可以通过索引访问项目。
#{fn:split(msg.testKey, ',')[0]}