2019-03-02
golang:
1. strings
string.Replace(s, " ", "%20", -1)
string.Split
string.SplitN: 最终分成N份
string.SplitAfter: 保留sep
strings.Join
len([]rune(s))
2. switch type
switch x := m.(type) {
case bool, int: // x's type is as m, usually interface
}
3. struct
type Param map[string]interface{}
type Show struct{Param}
这样是ok的,但是map需要单独make
type People struct {
name string `json:"name"`
}
小写的变量没法被外部访问,也不要加json,因为没法marshal
有疑问加站长微信联系(非本文作者)