Documentation
¶
Overview ¶
Package aghstrings contains utilities dealing with strings.
Index ¶
- func CloneSlice(a []string) (b []string)
- func CloneSliceOrEmpty(a []string) (b []string)
- func FilterOut(strs []string, f func(s string) (ok bool)) (filtered []string)
- func InSlice(strs []string, str string) (ok bool)
- func IsCommentOrEmpty(s string) (ok bool)
- func SplitNext(s *string, sep rune) (chunk string)
- func WriteToBuilder(b *strings.Builder, strs ...string)
- type Set
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CloneSliceOrEmpty ¶
CloneSliceOrEmpty returns the copy of a or empty strings slice if a is nil.
func FilterOut ¶
FilterOut returns a copy of strs with all strings for which f returned true removed.
func IsCommentOrEmpty ¶
IsCommentOrEmpty returns true of the string starts with a "#" character or is an empty string.
func SplitNext ¶
SplitNext splits string by a byte and returns the first chunk skipping empty ones. Whitespaces are trimmed.
func WriteToBuilder ¶
WriteToBuilder is a convenient wrapper for strings.(*Builder).WriteString that deals with multiple strings and ignores errors that are guaranteed to be nil.
Types ¶
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set is a set of strings.
func (*Set) Add ¶
Add adds s to the set. Add panics if the set is a nil set, just like a nil map does.
func (*Set) Del ¶
Del deletes s from the set. Calling Del on a nil set has no effect, just like delete on an empty map doesn't.
func (*Set) Has ¶
Has returns true if s is in the set. Calling Has on a nil set returns false, just like indexing on an empty map does.