Zippytal-Node/utitlity.go

17 lines
327 B
Go

package localserver
import "fmt"
func ToStringSlice(slice []any) (strSlice []string, err error) {
strSlice = []string{}
for _, value := range slice {
if strValue, ok := value.(string); ok {
strSlice = append(strSlice, strValue)
} else {
err = fmt.Errorf("value in slice of wrong type")
return
}
}
return
}