gpt4 book ai didi

arrays - 将数组附加到数组

转载 作者:行者123 更新时间:2023-12-05 09:21:09 25 4
gpt4 key购买 nike

我正在尝试将数组中的元素附加到现有(空)数组

if(attributes.list != "")           attributes.array.append(attributes.list.ListToArray());

我得到的是这样的

enter image description here

有没有一种方法可以做到这一点而不必太循环遍历每个项目?

最佳答案

使用 optional merge parameter :

If set to true, and value parameter is an array, appends array elements individually to the source array. If false (default) the complete array is added as one element at the end, in the source array. If value is not an array this argument is ignored.

设置 merge=true 将单独附加元素,而不是将整个数组作为单个元素附加:

attributes.array.append(attributes.list.ListToArray(), true);

ArrayAppend(array, merge) Example

关于arrays - 将数组附加到数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33931995/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com