strings.Split(待分割字符串,分割符)
- users := "张三,李四"
- userAry := strings.Split(users, ",")
-
- for _, u := range userAry {
- fmt.Println(u)
- }
运行结果:
strings.Contains(字符串,子字符串)
- users := "张三,李四"
- flag := strings.Contains(users, "李")
- fmt.Println(flag)
运行结果: