1. package main
    2. import (
    3. "fmt"
    4. "strings"
    5. )
    6. func testContains() {
    7. ips := "你好世界,hello world"
    8. //判断串是否包含某个字符串
    9. result := strings.Contains(ips,"hello")
    10. fmt.Println(result)
    11. }
    12. func main() {
    13. testContains()
    14. }

    输出:

    1. true