package main
import (
"fmt"
s "strings"
)
var log = fmt.Println
func main() {
log("Contains", s.Contains("test", "s"))
log("Count", s.Count("test", "t"))
log("HasPrefix", s.HasPrefix("test", "te"))
log("HasSuffix", s.HasSuffix("test", "st"))
log("Index", s.Index("test", "e"))
log("Repeat", s.Repeat("a", 5))
log("Replace1", s.Replace("test", "t", "T", 1))
log("Replace-1", s.Replace("test", "t", "T", -1))
log("Split1", s.Split("test", ""))
log("Split2", s.Split("t-e-s-t", "-"))
log("ToLower", s.ToLower("Test"))
log("ToUpper", s.ToUpper("test"))
log("len", len("test"))
log("char", "text"[1])
}
go-基础-string函数
最新推荐文章于 2023-05-07 21:18:55 发布