| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 
 | fmt.Println("包含子串返回:", strings.Contains("oldboy", "boy"))
 
 
 fmt.Println("存在返回第一个匹配字符的位置:", strings.Index("heloboyboy", "boy"))
 
 
 fmt.Println("子字符串出现次数:", strings.Count("hello world", "o"))
 fmt.Println("子字符串为空时, 返回:", strings.Count("hello", ""))
 
 
 fmt.Println(strings.Repeat("嘀嗒", 4), "时针它不停在转动")
 
 
 fmt.Println(strings.Replace("hel hel hel", "l", "llo", 2))
 fmt.Println(strings.Replace("hel hel hel", "l", "llo", -1))
 
 
 fmt.Println(strings.Trim("   hello   ", " "))
 
 
 fmt.Println(strings.Title("It is never too late to learn."))
 
 fmt.Println(strings.ToLower("It Is Never Too Late To Learn."))
 
 fmt.Println(strings.ToUpper("It is never too late to learn."))
 
 
 
 
 
 fmt.Println("前缀是以hello开头的:", strings.HasPrefix("helloworld", "hello"))
 
 
 fmt.Println("后缀是以world开头的:", strings.HasSuffix("helloworld", "world"))
 
 
 fmt.Printf("%q\n", strings.Split("a mountain a temple", "a "))
 
 
 fmt.Printf("Fields are: %q\n", strings.Fields(" Linux Python Golang  Java "))
 
 
 
 |