Documentation
¶
Index ¶
- type StringBuilder
- func (b *StringBuilder) Append(p []byte) *StringBuilder
- func (b *StringBuilder) AppendByte(c byte) *StringBuilder
- func (b *StringBuilder) AppendInt(n int) *StringBuilder
- func (b *StringBuilder) AppendRune(r rune) *StringBuilder
- func (b *StringBuilder) AppendString(s string) *StringBuilder
- func (b *StringBuilder) Cap() int
- func (b *StringBuilder) Grow(n int) *StringBuilder
- func (b *StringBuilder) Len() int
- func (b *StringBuilder) Reset() *StringBuilder
- func (b *StringBuilder) String() string
- func (b *StringBuilder) Write(p []byte) (int, error)
- func (b *StringBuilder) WriteByte(c byte) error
- func (b *StringBuilder) WriteRune(r rune) (int, error)
- func (b *StringBuilder) WriteString(s string) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type StringBuilder ¶
type StringBuilder struct {
// contains filtered or unexported fields
}
StringBuilder A Builder is used to efficiently build a string using Write methods. It minimizes memory copying. The zero value is ready to use. Do not copy a non-zero Builder.
func New ¶
func New(initCap ...int) *StringBuilder
func (*StringBuilder) Append ¶
func (b *StringBuilder) Append(p []byte) *StringBuilder
func (*StringBuilder) AppendByte ¶
func (b *StringBuilder) AppendByte(c byte) *StringBuilder
func (*StringBuilder) AppendInt ¶
func (b *StringBuilder) AppendInt(n int) *StringBuilder
func (*StringBuilder) AppendRune ¶
func (b *StringBuilder) AppendRune(r rune) *StringBuilder
func (*StringBuilder) AppendString ¶
func (b *StringBuilder) AppendString(s string) *StringBuilder
func (*StringBuilder) Cap ¶
func (b *StringBuilder) Cap() int
Cap returns the capacity of the builder's underlying byte slice. It is the total space allocated for the string being built and includes any bytes already written.
func (*StringBuilder) Grow ¶
func (b *StringBuilder) Grow(n int) *StringBuilder
Grow grows b's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to b without another allocation. If n is negative, Grow panics.
func (*StringBuilder) Len ¶
func (b *StringBuilder) Len() int
Len returns the number of accumulated bytes; b.Len() == len(b.String()).
func (*StringBuilder) Reset ¶
func (b *StringBuilder) Reset() *StringBuilder
Reset resets the Builder to be empty.
func (*StringBuilder) String ¶
func (b *StringBuilder) String() string
String returns the accumulated string.
func (*StringBuilder) Write ¶
func (b *StringBuilder) Write(p []byte) (int, error)
Write appends the contents of p to b's buffer. Write always returns len(p), nil.
func (*StringBuilder) WriteByte ¶
func (b *StringBuilder) WriteByte(c byte) error
WriteByte appends the byte c to b's buffer. The returned error is always nil.
func (*StringBuilder) WriteRune ¶
func (b *StringBuilder) WriteRune(r rune) (int, error)
WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer. It returns the length of r and a nil error.
func (*StringBuilder) WriteString ¶
func (b *StringBuilder) WriteString(s string) (int, error)
WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.