first commit
This commit is contained in:
23
pkg/htools/StringBuilder.go
Normal file
23
pkg/htools/StringBuilder.go
Normal file
@ -0,0 +1,23 @@
|
||||
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()
|
||||
}
|
||||
Reference in New Issue
Block a user