gpt4 book ai didi

coldfusion - 将单词 "and"附加到列表中的最后一个元素?

转载 作者:行者123 更新时间:2023-12-03 16:47:24 25 4
gpt4 key购买 nike

我有一个列表:“Apples, Eggs, Milk”,但我想在最后一个元素后面加上“and”,这样它就变成了“Apples, Eggs, and Milk”。

这是我的想法,但我似乎碰壁了,livedoc Adob​​e 文档站点已关闭(通常有有用的示例)。

<cfset VARIABLES.shoppingList= ListInsertAt(VARIABLES.shoppingList, ListLen(VARIABLES.shoppingList),'and')>

结果是:

不幸的是,“苹果、鸡蛋和牛奶”。也许 ListInsertAt 不是正确的方法?

最佳答案

我只使用 listSetAt 来修改最后一项。

<cfset variables.shoppinglist = listsetat(variables.shoppinglist, listlen(variables.shoppinglist), "and " & listlast(variables.shoppinglist))>

关于coldfusion - 将单词 "and"附加到列表中的最后一个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20641839/

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