aboutsummaryrefslogtreecommitdiff
path: root/src/bytes
diff options
context:
space:
mode:
authorRobert Griesemer <gri@golang.org>2015-01-22 09:16:20 -0800
committerRobert Griesemer <gri@golang.org>2015-01-22 18:28:35 +0000
commit19c1b163e85ba5a25d95f8174a90b2dc2470a18f (patch)
tree7f015c930ea16e6b2467bc94f2f08a22740ffa7e /src/bytes
parent494b4ce2a7bc9fd4813ea546ef589b3ce0fc980f (diff)
downloadgo-19c1b163e85ba5a25d95f8174a90b2dc2470a18f.tar.xz
bytes, strings: improve documentation for Count functions
Fixes #9659. Change-Id: If364d5984a0c9a48858ae524b1560f633e621826 Reviewed-on: https://go-review.googlesource.com/3181 Reviewed-by: Rob Pike <r@golang.org>
Diffstat (limited to 'src/bytes')
-rw-r--r--src/bytes/bytes.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bytes/bytes.go b/src/bytes/bytes.go
index 7634707b3c..f24a071d14 100644
--- a/src/bytes/bytes.go
+++ b/src/bytes/bytes.go
@@ -23,7 +23,7 @@ func equalPortable(a, b []byte) bool {
return true
}
-// explode splits s into a slice of UTF-8 sequences, one per Unicode character (still slices of bytes),
+// explode splits s into a slice of UTF-8 sequences, one per Unicode code point (still slices of bytes),
// up to a maximum of n byte slices. Invalid UTF-8 sequences are chopped into individual bytes.
func explode(s []byte, n int) [][]byte {
if n <= 0 {
@@ -47,6 +47,7 @@ func explode(s []byte, n int) [][]byte {
}
// Count counts the number of non-overlapping instances of sep in s.
+// If sep is an empty slice, Count returns 1 + the number of Unicode code points in s.
func Count(s, sep []byte) int {
n := len(sep)
if n == 0 {