标签:color code class hal lang inter make json test
var sum int = 17 mean:= float32(sum)
a := 5.0 b := int(a)
i,_ := strconv.Atoi("3") fmt.println(3 + i) // 6
fmt.println("a" + strconv.Itoa(32)) // a32
var v1 interface{}="asdf" fmt.Println(v1.(string))
var v2 interface{}=123 fmt.Println(v2.(int)+1) //124
var str string = "test" var b []byte = []byte(str)
var str string = string(b) var str string = string(b[:]) //or
str,err:=json.Marshal(stu)
stb := &Student{} err = json.Unmarshal([]byte(strData), &stb)
map1 := make(map[string]interface{}) map1["1"] = "hello" map1["2"] = "world" str, err := json.Marshal(map1) //return []byte fmt.Println("map to json", string(str))
map2 := make(map[string]interface{}) err = json.Unmarshal([]byte(jsonStr), &map2)
str := string(arr[:])
s = strings.Split("abc,abc", ",") fmt.Println(s, len(s)) //[abc abc] 2
标签:color code class hal lang inter make json test
原文地址:https://www.cnblogs.com/xbblogs/p/10376518.html