`GO语言bytes包Count函数的用法及代码示例。
用法:
func Count(s, sep []byte) intCount对s中的sep的非重叠实例进行计数。如果sep是空片,则Count返回1 +以s为单位的UTF-8编码的代码点数。
▾示例
package main
import (
    "bytes"
    "fmt"
)
func main() {
    fmt.Println(bytes.Count([]byte("cheese"), []byte("e")))
    fmt.Println(bytes.Count([]byte("five"), []byte(""))) // before & after each rune
}