Contains

Contains 返回 s 内是否包含 substr。

Contains

函数定义

func Contains(s, substr string) bool

代码示例

package main

import (
    "fmt"
    "strings"
)

func main() {
    fmt.Println(strings.Contains("seafood", "foo")) //true
    fmt.Println(strings.Contains("seafood", "bar")) //false
    fmt.Println(strings.Contains("seafood", "")) //true
    fmt.Println(strings.Contains("", "")) //true
}