map.go
524 Bytes
package zconvert
/* ----- string -> map ----- */
func ToMapStr(str string, sep1, sep2 string) map[string]string {
result := make(map[string]string)
list := ToListListStr(str, sep1, sep2)
for _, i2 := range list {
if len(i2) >= 2 {
result[i2[0]] = i2[1]
}
}
return result
}
func ToMapInt32(str string, sep1, sep2 string) map[int32]int32 {
result := make(map[int32]int32)
list := ToListListInt32(str, sep1, sep2)
for _, i2 := range list {
if len(i2) >= 2 {
result[i2[0]] = i2[1]
}
}
return result
}