String returns the contents of the unread portion of the buffer as a string. If the Buffer is a nil pointer, it returns " ". To build strings more efficiently, see the strings.Builder type.
()
| 31 | // |
| 32 | // To build strings more efficiently, see the strings.Builder type. |
| 33 | func (buf *Buffer) String() string { |
| 34 | buf.mutex.Lock() |
| 35 | r := buf.buffer.String() |
| 36 | buf.mutex.Unlock() |
| 37 | return r |
| 38 | } |
| 39 | |
| 40 | // Reset resets the buffer to be empty, |
| 41 | // but it retains the underlying storage for use by future writes. |