Documentation ¶
Index ¶
- func AsciiEqualFold(s, t []byte) bool
- func EqualFoldRight(s, t []byte) bool
- func FoldFunc(s []byte) func(s, t []byte) bool
- func Indices(str, substr string) []int
- func IsAllBlank[S ~string](ss ...S) bool
- func IsAllEmpty[S ~string](ss ...S) bool
- func IsAnyBlank[S ~string](ss ...S) bool
- func IsAnyEmpty[S ~string](ss ...S) bool
- func IsBlank[S ~string](s S) bool
- func IsEmpty[S ~string](s S) bool
- func IsNotBlank[S ~string](s S) bool
- func IsNotEmpty[S ~string](s S) bool
- func IsValidNumber(s string) bool
- func Match(str string, pattern string) []string
- func Remove(s string, chars string) string
- func ReplaceFunc(str string, f func(rune) string) string
- func SimpleLetterEqualFold(s, t []byte) bool
- func SnackCase(s string) string
- type Builder
- func (b *Builder) Cap() int
- func (b *Builder) Grow(n int)
- func (b *Builder) Len() int
- func (b *Builder) Reset()
- func (b *Builder) String() string
- func (b *Builder) Write(p []byte) (int, error)
- func (b *Builder) WriteBool(bl bool) error
- func (b *Builder) WriteByte(c byte) error
- func (b *Builder) WriteFloat(f float64, fmt byte, prec, bitSize int) error
- func (b *Builder) WriteInt(i int64, base int) error
- func (b *Builder) WriteQuote(s string) error
- func (b *Builder) WriteQuoteRune(r rune) error
- func (b *Builder) WriteQuoteRuneToASCII(r rune) error
- func (b *Builder) WriteQuoteRuneToGraphic(r rune) error
- func (b *Builder) WriteQuoteToASCII(s string) error
- func (b *Builder) WriteQuoteToGraphic(s string) error
- func (b *Builder) WriteRune(r rune) (int, error)
- func (b *Builder) WriteString(s string) (int, error)
- func (b *Builder) WriteUint(i uint64, base int) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AsciiEqualFold ¶
AsciiEqualFold is a specialization of bytes.EqualFold for use when s is all ASCII (but may contain non-letters) and contains no special-folding letters. See comments on FoldFunc.
func EqualFoldRight ¶
EqualFoldRight is a specialization of bytes.EqualFold when s is known to be all ASCII (including punctuation), but contains an 's', 'S', 'k', or 'K', requiring a Unicode fold on the bytes in t. See comments on FoldFunc.
func FoldFunc ¶
FoldFunc returns one of four different case folding equivalence functions, from most general (and slow) to fastest:
1) bytes.EqualFold, if the key s contains any non-ASCII UTF-8 2) EqualFoldRight, if s contains special folding ASCII ('k', 'K', 's', 'S') 3) AsciiEqualFold, no special, but includes non-letters (including _) 4) SimpleLetterEqualFold, no specials, no non-letters.
The letters S and K are special because they map to 3 runes, not just 2:
- S maps to s and to U+017F 'ſ' Latin small letter long s
- k maps to K and to U+212A 'K' Kelvin sign
See https://play.golang.org/p/tTxjOc0OGo
The returned function is specialized for matching against s and should only be given s. It's not curried for performance reasons.
func IsAllBlank ¶
IsAllBlank Checks if all of the CharSequences are empty ("") or whitespace only.
func IsAllEmpty ¶
IsAllEmpty Checks if all of the strings are empty ("")
func IsAnyBlank ¶
IsAnyBlank Checks if any of the string are empty ("") or whitespace only.
func IsAnyEmpty ¶
IsAnyEmpty Checks if any of the strings are empty ("")
func IsNotBlank ¶
IsNotBlank Checks if a string is not empty ("") and not whitespace only.
func IsNotEmpty ¶
IsNotEmpty Checks if a string is not empty ("")
func IsValidNumber ¶
IsValidNumber reports whether s is a valid number.
func SimpleLetterEqualFold ¶
SimpleLetterEqualFold is a specialization of bytes.EqualFold for use when s is all ASCII letters (no underscores, etc) and also doesn't contain 'k', 'K', 's', or 'S'. See comments on FoldFunc.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
func NewBuilder ¶
func NewBuilder() *Builder
func NewBuilderBuilder ¶
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. If n is negative, Grow panics.
func (*Builder) Write ¶
Write appends the contents of p to b's buffer. Write always returns len(p), nil.
func (*Builder) WriteByte ¶
WriteByte appends the byte c to b's buffer. The returned error is always nil.
func (*Builder) WriteFloat ¶
WriteFloat appends the string form of the floating-point number f.
func (*Builder) WriteQuote ¶
WriteQuote appends a double-quoted Go string literal representing s.
func (*Builder) WriteQuoteRune ¶
WriteQuoteRune appends a single-quoted Go character literal representing the rune.
func (*Builder) WriteQuoteRuneToASCII ¶
WriteQuoteRuneToASCII appends a single-quoted Go character literal representing the rune.
func (*Builder) WriteQuoteRuneToGraphic ¶
WriteQuoteRuneToGraphic appends a single-quoted Go character literal representing the rune.
func (*Builder) WriteQuoteToASCII ¶
WriteQuoteToASCII appends a double-quoted Go string literal representing s.
func (*Builder) WriteQuoteToGraphic ¶
WriteQuoteToGraphic appends a double-quoted Go string literal representing s.
func (*Builder) WriteRune ¶
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 (*Builder) WriteString ¶
WriteString appends the contents of s to b's buffer. It returns the length of s and a nil error.