我正在尝试根据从调用它的函数接收到的元素来格式化字符串。这个元素的数量可以从一个变化到多个。
有没有办法用可变数量的元素调用 fmt.Sprintf 。类似于以下内容:
receivedElements := []interface{}{"some","values"}
formattedString := fmt.Sprintf("Received elements: ...%s", receivedElements...)
Output: Received elements: some values