1 2 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
| fmt.Println(strings.Contains("helloogo", "hello")) fmt.Println(strings.Contains("helloogo", "goe"))
s := []string{"abc", "hello", "mike", "go"} buf := strings.Join(s, "_") fmt.Println("buf = ", buf)
fmt.Println(strings.Index("abcdhello", "hello")) fmt.Println(strings.Index("abcdhello", "go"))
buf = strings.Repeat("go", 3) fmt.Println("buf = ", buf)
buf = "hello&abc&go&mike&you" s2 := strings.Split(buf, "&") fmt.Println("s2 = ", s2)
buf = strings.Trim(" are you ok ", " ") fmt.Println("buf = ", buf)
s3 := strings.Fields(" are you ok? ") for i, data := range s3 { fmt.Println(i, ", ", data) }
|