Documentation
¶
Overview ¶
Package str contains string functions
Index ¶
- func CleanSplit(text, sep string) []string
- func CleanSplitN(text, sep string, n int) []string
- func CleanSplitter(sep string) func(string) []string
- func CleanSplitterN(sep string, n int) func(string) []string
- func Guard(text, guard string) string
- func IndentedJSON[T any](item T, tabLength int) (string, error)
- func IsEmpty(text string) bool
- func JSON[T any](item T) (string, error)
- func Join(glue string, parts ...string) string
- func Len(text string) int
- func MarshalJSON[T any](item T, tabLength int) ([]byte, error)
- func NotEmpty(text string) bool
- func Repeat(count int, text, glue string) string
- func SpaceSplit(text string) []string
- func Wrap(text, wrapper string) string
- func WrapList(items []string, wrapper string) string
- type Builder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanSplit ¶
CleanSplit splits the text by separator, and trims each part's extra whitespace
func CleanSplitN ¶
CleanSplitN splits the text by separator, maximum of N parts, then trims each part's extra whitespace
func CleanSplitter ¶
CleanSplitter creates a function that splits the text by separator, and trims each part's extra whitespace
func CleanSplitterN ¶
CleanSplitterN creates a function that splits the text by separator, maximum of N parts, and trims each part's whitespace
func Guard ¶
Guard returns the guard string if given string is empty, otherwise returns the given string
func IndentedJSON ¶ added in v0.3.7
IndentedJSON creates an indented JSON string from struct
func MarshalJSON ¶ added in v0.3.7
MarshalJSON marshals the struct as JSON, with tabLength indicating whether to indent or not