Files
servicebase/pkg/htools/StringBuilder.go
2025-11-18 17:48:20 +08:00

24 lines
386 B
Go

package htools
import (
"bytes"
"fmt"
)
type StringBuilder struct {
buf bytes.Buffer
}
func NewStringBuilder() *StringBuilder {
return &StringBuilder{buf: bytes.Buffer{}}
}
func (this *StringBuilder) Append(obj interface{}) *StringBuilder {
this.buf.WriteString(fmt.Sprintf("%v", obj))
return this
}
func (this *StringBuilder) ToString() string {
return this.buf.String()
}