I have a variable array of integers that I would like to format into a string. When I pass the array, it is placed into the first format verb and the rest are listed as missing. For example, I pass [10, 100, 250, 99] and a format of "%02d-%04d-%04d-%02d". I want it to return "10-0100-0250-99". What is the correct way to do this in go?
package main
include (
"fmt"
)
func main() {
nums := []int{10,100,250,99}
format := "%02d-%04d-%04d-%02d
"
fmt.Printf(format, 10, 100, 250, 99)
fmt.Printf(format, nums)
}
[10 100 250 99]-%!d(MISSING)-%!d(MISSING)-%!d(MISSING) (Wrong) 10-0100-0250-99 (correct)