如何使用以下输出[“1”,“2”,“3”,“4”,...]或[“one”,“two”,“three”,“four”,. ..]来自这个阵列[“1 one”,“2 two”,“3 three”,“4 four”,......]。
答案 0 :(得分:0)
你可以简单地用for循环拆分它。
<bean id="connectionFactory" class="org.springframework.amqp.rabbit.connection.CachingConnectionFactory">
<property name="connectionTimeout" value="1000" />
<property name="concurrency" value="16" /> <!-- in milliseconds -->
<property name="recoveryInterval" value="5000" />
</bean>
感谢@Martin R
答案 1 :(得分:0)
尝试使用此格式Array ["1 one", "2 two", "3 three", "4 four", ...]
var firstValArr : [String]?
var lastValArr : [String]?
for i in 0 ..< yourArray.count {
let arrayElement = yourArray[i]
let splitArrayElement = arrayElement.components(separatedBy: " ")
let firstValue = splitArrayElement[0]
let lastValue = splitArrayElement[1]
firstValArr.append(firstValue)
lastValArr.append(lastValue)
}
print("First Value Array : \(firstValArr)")
print("Last Value Array: \(lastValArr)")