Documentation ¶
Overview ¶
strbld package provides a string Builder that can be used with older go versions as well. The builder provided by strings.Builder will be used for go versions 1.10+. The Builder interface is fully compatible to strings.Builder. Only additional methods available are Pad and Fmt. If go versions < 1.10 are used, no additional methods of the underlying buffer can be used.
Index ¶
- type Builder
- func (b *Builder) Fmt(s string, vs ...interface{})
- func (b *Builder) Grow(n int)
- func (b *Builder) Len() int
- func (b *Builder) Pad(str string)
- func (b *Builder) Reset()
- func (b *Builder) String() string
- func (b *Builder) Write(p []byte) (int, error)
- func (b *Builder) WriteByte(c byte) error
- func (b *Builder) WriteRune(r rune) (int, error)
- func (b *Builder) WriteString(s string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder provides support to construct a string using Write methods. It minimizes memory copying.
func (*Builder) Grow ¶
Grow increases the buffer its capacity if required. After grow, at least n bytes can be written without further allocations.
func (*Builder) Reset ¶
func (b *Builder) Reset()
Reset clears the buffer. The buffer for a new string will not be shared with the original strings buffer.