I'd like to convert a slice of strings to a slice of slices of bytes.
I can use a for-loop to convert each string to a slice and append to the recipient slice. But I am not sure this is the most succinct way. Could anybody show me the most succinct way to convert a slice of strings to a slice of slices? Thanks.
Here is a simple example using os.Args
as the input slice of string.
var fields [][]byte
for _, x := range os.Args[3:] {
fields = append(fields, []byte(x))
}