Added convs.

This commit is contained in:
Andrey Parhomenko 2022-11-28 00:16:20 +05:00
parent 0a23c4a5a4
commit 28536eb2e0

View file

@ -14,3 +14,22 @@ func MakeMap[K comparable, V any](
return r
}
func ConvStr[V1, V2 ~string](v1 []V1) []V2 {
ret := []V2{}
for i := range v1 {
ret = append(ret, V2(v1[i]))
}
return ret
}
func ConvInt[V1, V2 ~int](v1 []V1) []V2 {
ret := []V2{}
for i := range v1 {
ret = append(ret, V2(v1[i]))
}
return ret
}