bytes: add IndexRune, FieldsFunc and To*Special

Basically these functions are implemented the same way as the
corresponding functions in the strings package.  Test functions
are implemented for IndexRune and FieldsFunc.

Additionally two typos are fixed in packages bytes and strings.

R=r
CC=golang-dev
https://golang.org/cl/1696062
This commit is contained in:
Christian Himpel 2010-08-05 23:11:06 +10:00 committed by Rob Pike
parent 895c5db6df
commit 75f6a0c759
3 changed files with 83 additions and 5 deletions

View file

@ -191,7 +191,7 @@ func Fields(s string) []string {
return FieldsFunc(s, unicode.IsSpace)
}
// FieldsFunc splits the string s at each run of Unicode code points c satifying f(c)
// FieldsFunc splits the string s at each run of Unicode code points c satisfying f(c)
// and returns an array of slices of s. If no code points in s satisfy f(c), an empty slice
// is returned.
func FieldsFunc(s string, f func(int) bool) []string {