From 2603914c98abcda0dd0f5c0b511ecb2ddd8426bc Mon Sep 17 00:00:00 2001 From: gazebo Date: Sun, 21 Jul 2019 20:44:10 +0800 Subject: [PATCH] - StringSlice2Int --- utils/typeconv.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/utils/typeconv.go b/utils/typeconv.go index b2d31977..9e75380a 100644 --- a/utils/typeconv.go +++ b/utils/typeconv.go @@ -512,6 +512,16 @@ func StringSlice2Int64(intList []string) (outList []int64) { return outList } +func StringSlice2Int(intList []string) (outList []int) { + if len(intList) > 0 { + outList = make([]int, len(intList)) + for k, v := range intList { + outList[k] = int(Str2Int64WithDefault(v, 0)) + } + } + return outList +} + func IntSlice2Int64(intList []int) (outList []int64) { if len(intList) > 0 { outList = make([]int64, len(intList))