crstrings

package
v0.0.0-...-f2c3c5e Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2025 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FilterEmpty

func FilterEmpty(elems []string) []string

FilterEmpty removes empty strings from the given slice.

func If

func If(flag bool, trueValue string) string

If returns the given value if the flag is true, otherwise an empty string.

func IfElse

func IfElse(flag bool, trueValue, falseValue string) string

IfElse returns the value that matches the value of the flag.

func Indent

func Indent(prepend, str string) string

Indent prepends a string to every line of the given string.

If the string ends in a newline, the resulting string also ends in a newline.

func JoinStringers

func JoinStringers[T fmt.Stringer](delim string, args ...T) string

JoinStringers concatenates the string representations of the given fmt.Stringer implementations.

func Lines

func Lines(s string) []string

Lines breaks up the given string into lines.

func MapAndJoin

func MapAndJoin[T any](fn func(T) string, delim string, args ...T) string

MapAndJoin converts each argument to a string using the given function and joins the strings with the given delimiter.

func WithSep

func WithSep(a string, separator string, b string) string

WithSep prints the strings a and b with the given separator in-between, unless one of the strings is empty (in which case the other string is returned).

Types

This section is empty.

Jump to

Keyboard shortcuts

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