Documentation ¶
Index ¶
- func FirstNParts(s string, n int, sep string) string
- func FirstNPartsIdx(s string, n int, sep string) int
- func FirstNPartsX(s string, n int, sep string) (parts, remain string)
- func FirstPart(s, sep string) string
- func FirstPartIdx(s, sep string) int
- func FirstPartX(s, sep string) (first, remain string)
- func JoinFunc[T any](list []T, sep string, fn func(T) string) string
- func LastNParts(s string, n int, sep string) string
- func LastNPartsIdx(s string, n int, sep string) int
- func LastNPartsX(s string, n int, sep string) (parts, remain string)
- func LastPart(s, sep string) string
- func LastPartIdx(s, sep string) int
- func LastPartX(s, sep string) (last, remain string)
- type Builder
- func (b *Builder) Cap() int
- func (b *Builder) Grow(n int)
- func (b *Builder) Len() int
- func (b *Builder) Print(args ...any)
- func (b *Builder) PrintBytes(p []byte)
- func (b *Builder) Printf(format string, args ...any)
- func (b *Builder) Println(args ...any)
- 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) WriteByteZ(c byte)
- func (b *Builder) WriteRune(r rune) (int, error)
- func (b *Builder) WriteRuneZ(r rune) int
- func (b *Builder) WriteString(s string) (int, error)
- func (b *Builder) WriteStringZ(s string) int
- func (b *Builder) WriteZ(p []byte) int
- type BuilderFunc
- type StringFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FirstNPartsX ¶ added in v0.1.0
func FirstPartIdx ¶ added in v0.1.0
func FirstPartX ¶ added in v0.1.0
func LastNPartsX ¶ added in v0.1.0
func LastPartIdx ¶ added in v0.1.0
Types ¶
type Builder ¶
func (*Builder) PrintBytes ¶
func (*Builder) WriteByteZ ¶
func (*Builder) WriteRuneZ ¶
func (*Builder) WriteStringZ ¶
type BuilderFunc ¶ added in v0.1.2
type BuilderFunc func(b *Builder)
StringFunc wraps a function to make it implement fmt.Stringer. It is useful when you want to delay evaluation of the function. The function receives a stringz.Builder. For example:
msg := BuilderFunc(func(b *stringz.Builder) string { b.Printf("JSON(obj)=%v", formatJSON(obj)) }) log.Debug(msg) // 👈 only run formatJSON() if debug level is enabled
func (BuilderFunc) String ¶ added in v0.1.2
func (fn BuilderFunc) String() string
type StringFunc ¶ added in v0.1.1
type StringFunc func() string
StringFunc wraps a function to make it implement fmt.Stringer. It is useful when you want to delay evaluation of the function. For example:
msg := StringFunc(func() string { return fmt.Sprintf("JSON(obj)=%v", formatJSON(obj)) }) log.Debug(msg) // 👈 only run formatJSON() if debug level is enabled
func (StringFunc) String ¶ added in v0.1.1
func (fn StringFunc) String() string
Click to show internal directories.
Click to hide internal directories.