cast
cast copied to clipboard
"ToStringSlice" does not support slice of ints?
I was hoping that ToStringSlice
would support turning a slice of ints into a slice of strings. Am I wrong in that assumption?
The following fails:
nums := []int{1,2,3,4,5}
out := cast.ToStringSlice(nums)
// expected: []string{"1","2","3","4","5"}
// actual: []
If I use ToStringSliceE
I get the error:
unable to cast []int{1, 2, 3, 4, 5} of type []int to []string
Is there a cast method that does what I want that I'm not aware of?