fmt.Println(strings.ToUpper("hello world")) //转换为大写
    fmt.Println(strings.ToLower("HELLO WORLD")) //转换为小写
    fmt.Println(strings.Contains("hello world", "world")) //查找子串是否在指定的字符串中
    fmt.Println(strings.Count("Hello World", "l"))//判断字符在另一字符串中出现的次数
    fmt.Println(strings.EqualFold("hello world", "hello world"))//判断两个字符串是否相等,并且不区分大小写
    fmt.Println(strings.Index("hello world", "l")) //判断字符在另一字符串中第一次出现的位置

    strings.Split("a,b,c,d,e", "/") //分割字符串

发表评论