- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for NewBufferString (0.16 sec)
-
src/bytes/buffer_test.go
}) if n > 0 { t.Errorf("allocations occurred while shallow copying") } check(t, "NewBuffer", &buf, testString) } func TestNewBufferString(t *testing.T) { buf := NewBufferString(testString) check(t, "NewBufferString", buf, testString) } // Empty buf through repeated reads into fub. // The initial contents of buf corresponds to the string s.
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Fri Apr 26 13:31:36 GMT 2024 - 18.6K bytes - Viewed (0) -
src/bytes/buffer.go
func NewBuffer(buf []byte) *Buffer { return &Buffer{buf: buf} } // NewBufferString creates and initializes a new [Buffer] using string s as its // initial contents. It is intended to prepare a buffer to read an existing // string. // // In most cases, new([Buffer]) (or just declaring a [Buffer] variable) is // sufficient to initialize a [Buffer]. func NewBufferString(s string) *Buffer { return &Buffer{buf: []byte(s)}
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Fri Oct 13 17:10:31 GMT 2023 - 15.7K bytes - Viewed (0) -
src/bytes/example_test.go
b.Write([]byte("Hello ")) fmt.Fprintf(&b, "world!") b.WriteTo(os.Stdout) // Output: Hello world! } func ExampleBuffer_reader() { // A Buffer can turn a string or a []byte into an io.Reader. buf := bytes.NewBufferString("R29waGVycyBydWxlIQ==") dec := base64.NewDecoder(base64.StdEncoding, buf) io.Copy(os.Stdout, dec) // Output: Gophers rule! } func ExampleBuffer_Bytes() { buf := bytes.Buffer{}
Go - Registered: Tue Apr 30 11:13:12 GMT 2024 - Last Modified: Mon Mar 04 15:54:40 GMT 2024 - 15K bytes - Viewed (1)