//字符串和数字互相转换
// string转成int:
int, err := strconv.Atoi(string)
// string转成int64:
int64, err := strconv.ParseInt(string, 10, 64)
// int转成string:
string := strconv.Itoa(int)
// int64转成string:
string := strconv.FormatInt(int64,10)
//判断两个数组是否相等
func StringSliceEqual(a, b []string) bool {
if len(a) != len(b) {
return false
}
if (a == nil) != (b == nil) {
return false
}
for i, v := racnge a {
if v != b[i] {
return false
}
}
return true
}
//把array/slice转成逗号分隔的字符串
//[a b c] -> a b c -> a,b,c
strings.Replace(strings.Trim(fmt.Sprint(array_or_slice), "[]"), " ", ",", -1)