Lines Matching full:bytes
8 "bytes"
18 var b bytes.Buffer // A Buffer needs no initialization.
27 buf := bytes.NewBufferString("R29waGVycyBydWxlIQ==")
36 if bytes.Compare(a, b) < 0 {
39 if bytes.Compare(a, b) <= 0 {
42 if bytes.Compare(a, b) > 0 {
45 if bytes.Compare(a, b) >= 0 {
50 if bytes.Equal(a, b) {
53 if !bytes.Equal(a, b) {
64 return bytes.Compare(haystack[i], needle) >= 0
66 if i < len(haystack) && bytes.Equal(haystack[i], needle) {
73 b = bytes.TrimSuffix(b, []byte("goodbye, etc!"))
74 b = bytes.TrimSuffix(b, []byte("gopher"))
75 b = append(b, bytes.TrimSuffix([]byte("world!"), []byte("x!"))...)
82 b = bytes.TrimPrefix(b, []byte("Goodbye,"))
83 b = bytes.TrimPrefix(b, []byte("See ya,"))
89 fmt.Printf("Fields are: %q", bytes.Fields([]byte(" foo bar baz ")))
97 fmt.Printf("Fields are: %q", bytes.FieldsFunc([]byte(" foo1;bar2,baz3..."), f))
102 fmt.Println(bytes.Contains([]byte("seafood"), []byte("foo")))
103 fmt.Println(bytes.Contains([]byte("seafood"), []byte("bar")))
104 fmt.Println(bytes.Contains([]byte("seafood"), []byte("")))
105 fmt.Println(bytes.Contains([]byte(""), []byte("")))
114 fmt.Println(bytes.Count([]byte("cheese"), []byte("e")))
115 fmt.Println(bytes.Count([]byte("five"), []byte(""))) // before & after each rune
122 fmt.Println(bytes.EqualFold([]byte("Go"), []byte("go")))
127 fmt.Println(bytes.HasPrefix([]byte("Gopher"), []byte("Go")))
128 fmt.Println(bytes.HasPrefix([]byte("Gopher"), []byte("C")))
129 fmt.Println(bytes.HasPrefix([]byte("Gopher"), []byte("")))
137 fmt.Println(bytes.HasSuffix([]byte("Amigo"), []byte("go")))
138 fmt.Println(bytes.HasSuffix([]byte("Amigo"), []byte("O")))
139 fmt.Println(bytes.HasSuffix([]byte("Amigo"), []byte("Ami")))
140 fmt.Println(bytes.HasSuffix([]byte("Amigo"), []byte("")))
149 fmt.Println(bytes.Index([]byte("chicken"), []byte("ken")))
150 fmt.Println(bytes.Index([]byte("chicken"), []byte("dmr")))
160 fmt.Println(bytes.IndexFunc([]byte("Hello, ??"), f))
161 fmt.Println(bytes.IndexFunc([]byte("Hello, world"), f))
168 fmt.Println(bytes.IndexAny([]byte("chicken"), "aeiouy"))
169 fmt.Println(bytes.IndexAny([]byte("crwth"), "aeiouy"))
176 fmt.Println(bytes.IndexRune([]byte("chicken"), 'k'))
177 fmt.Println(bytes.IndexRune([]byte("chicken"), 'd'))
184 fmt.Println(bytes.Index([]byte("go gopher"), []byte("go")))
185 fmt.Println(bytes.LastIndex([]byte("go gopher"), []byte("go")))
186 fmt.Println(bytes.LastIndex([]byte("go gopher"), []byte("rodent")))
195 fmt.Printf("%s", bytes.Join(s, []byte(", ")))
200 fmt.Printf("ba%s", bytes.Repeat([]byte("na"), 2))
205 fmt.Printf("%s\n", bytes.Replace([]byte("oink oink oink"), []byte("k"), []byte("ky"), 2))
206 fmt.Printf("%s\n", bytes.Replace([]byte("oink oink oink"), []byte("oink"), []byte("moo"), -1))
213 fmt.Printf("%q\n", bytes.Split([]byte("a,b,c"), []byte(",")))
214 fmt.Printf("%q\n", bytes.Split([]byte("a man a plan a canal panama"), []byte("a ")))
215 fmt.Printf("%q\n", bytes.Split([]byte(" xyz "), []byte("")))
216 fmt.Printf("%q\n", bytes.Split([]byte(""), []byte("Bernardo O'Higgins")))
225 fmt.Printf("%q\n", bytes.SplitN([]byte("a,b,c"), []byte(","), 2))
226 z := bytes.SplitN([]byte("a,b,c"), []byte(","), 0)
234 fmt.Printf("%q\n", bytes.SplitAfter([]byte("a,b,c"), []byte(",")))
239 fmt.Printf("%q\n", bytes.SplitAfterN([]byte("a,b,c"), []byte(","), 2))
244 fmt.Printf("%s", bytes.Title([]byte("her royal highness")))
249 fmt.Printf("%s\n", bytes.ToTitle([]byte("loud noises")))
250 fmt.Printf("%s\n", bytes.ToTitle([]byte("????")))
257 fmt.Printf("[%q]", bytes.Trim([]byte(" !!! Achtung! Achtung! !!! "), "! "))
271 fmt.Printf("%s", bytes.Map(rot13, []byte("'Twas brillig and the slithy gopher...")))
276 fmt.Printf("%s", bytes.TrimSpace([]byte(" \t\n a lone gopher \n\t\r\n")))
281 fmt.Printf("%s", bytes.ToUpper([]byte("Gopher")))
286 fmt.Printf("%s", bytes.ToLower([]byte("Gopher")))