Documentation
¶
Index ¶
- func Split2(s string, sep string) (string, string, int)
- func SplitN(s string, sep string, buf []string) []string
- func UnsafeString(b []byte) string
- func UnsafeStringBytes(s *string) []byte
- func UnsafeStringFromPtr(ptr *byte, length int) (s string)
- type Builder
- func (sb *Builder) Bytes() []byte
- func (sb *Builder) Cap() int
- func (sb *Builder) Grow(capacity int)
- func (sb *Builder) Len() int
- func (sb *Builder) Map(mapping func(rune) rune, s string)
- func (sb *Builder) Release()
- func (sb *Builder) Reset()
- func (sb *Builder) String() string
- func (sb *Builder) Write(bytes []byte) (int, error)
- func (sb *Builder) WriteByte(c byte)
- func (sb *Builder) WriteBytes(bytes []byte)
- func (sb *Builder) WriteFloat(f float64, fmt byte, prec, bitSize int)
- func (sb *Builder) WriteInt(i int64, base int)
- func (sb *Builder) WriteRune(r rune)
- func (sb *Builder) WriteString(s string)
- func (sb *Builder) WriteStringLower(s string)
- func (sb *Builder) WriteStringUpper(s string)
- func (sb *Builder) WriteUint(i uint64, base int)
- type Template
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Split2 ¶
Split2 return the split string results (without memory allocations)
If sep string not found: 's' '' 1 If s or sep string is empthy: 's' '' 1 In other cases: 's0' 's2' 2
func SplitN ¶
SplitN return splitted slice (use pre-allocated buffer) and end position (for detect if string contains more fields for split)
func UnsafeString ¶
UnsafeString returns the string under byte buffer
func UnsafeStringBytes ¶
UnsafeStringBytes returns the string bytes
func UnsafeStringFromPtr ¶
UnsafeStringFromPtr returns the string with specific length under byte buffer
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
A Builder is used to efficiently build a string using Write methods (with better perfomance than strings.Builder). It minimizes memory copying. The zero value is ready to use. Do not copy a non-zero Builder.
func (*Builder) Cap ¶
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 (*Builder) Grow ¶
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.
func (*Builder) Map ¶
based on strings.Map Map returns a copy of the string s with all its characters modified according to the mapping function. If mapping returns a negative value, the character is dropped from the string with no replacement.
func (*Builder) Release ¶
func (sb *Builder) Release()
Release resets the Builder to be empty and free buffer
func (*Builder) WriteBytes ¶
WriteBytes appends the contents of p to b's buffer.
func (*Builder) WriteFloat ¶
WriteFloat appends the string form of the floating-point number f, as generated by FormatFloat, to dst and returns the extended buffer.
func (*Builder) WriteInt ¶
WriteInt appends the string form of the integer i, as generated by FormatInt, to dst and returns the extended buffer.
func (*Builder) WriteRune ¶
WriteRune appends the UTF-8 encoding of Unicode code point r to b's buffer.
func (*Builder) WriteString ¶
WriteString appends the contents of s to b's buffer.
func (*Builder) WriteStringLower ¶
based on strings.ToLower ToLower returns s with all Unicode letters mapped to their lower case.
func (*Builder) WriteStringUpper ¶
based on strings.ToUpper ToUpper returns s with all Unicode letters mapped to their upper case.
type Template ¶
type Template []interface{}
Template parsed and splited format string (stored in first field)
func InitTemplate ¶
InitTemplate parse and split format string (format string stored in first field)
@format Format string like 'string %{param} %{param1.param2}'