aghstrings

package
v0.106.0-b.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 19, 2021 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package aghstrings contains utilities dealing with strings.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloneSlice

func CloneSlice(a []string) (b []string)

CloneSlice returns the exact copy of a.

func CloneSliceOrEmpty

func CloneSliceOrEmpty(a []string) (b []string)

CloneSliceOrEmpty returns the copy of a or empty strings slice if a is nil.

func FilterOut

func FilterOut(strs []string, f func(s string) (ok bool)) (filtered []string)

FilterOut returns a copy of strs with all strings for which f returned true removed.

func InSlice

func InSlice(strs []string, str string) (ok bool)

InSlice checks if string is in the slice of strings.

func IsCommentOrEmpty

func IsCommentOrEmpty(s string) (ok bool)

IsCommentOrEmpty returns true of the string starts with a "#" character or is an empty string.

func SplitNext

func SplitNext(s *string, sep rune) (chunk string)

SplitNext splits string by a byte and returns the first chunk skipping empty ones. Whitespaces are trimmed.

func WriteToBuilder

func WriteToBuilder(b *strings.Builder, strs ...string)

WriteToBuilder is a convenient wrapper for strings.(*Builder).WriteString that deals with multiple strings and ignores errors that are guaranteed to be nil.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL