gpt4 book ai didi

go - 将 map 值转换为不带括号的纯字符串?

转载 作者:数据小太阳 更新时间:2023-10-29 03:47:33 26 4
gpt4 key购买 nike

<分区>

我有一个看起来像这样的映射字符串

map[first:[hello] second:[world]]

问题是,当我遍历它并返回值时,它们返回 [hello] [world] 而我希望它们只返回 hello world

// currentMap is of type map[interface{}]interface{} originally
newStringMap := make(map[string]interface{})

for k, v := range currentMap {
newStringMap[k.(string)] = v
}

return newStringMap

如何做到这一点?

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