strings

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.9.0

func Contains(s []string, e string) bool

Contains returns whether the given slice of strings contains the given string.

func ExpandWhitespaceLiterals added in v0.6.0

func ExpandWhitespaceLiterals(s string) string

Expand literal escaped whitespace characters in the given string to their actual character.

func InList

func InList(strings []string, s string) bool

InList returns whether the string is part of the given list of strings.

func IsURL

func IsURL(s string) bool

IsURL returns whether the given string is a valid URL.

func JoinInt64

func JoinInt64(ints []int64, delimiter string) string

JoinInt64 joins a list of int64 into a single string with the given delimiter.

func JoinLines

func JoinLines(s string) string

JoinLines joins each lines of the given string by replacing the newlines by a single space.

func Pluralize

func Pluralize(word string, count int) string

Pluralize adds an `s` at the end of word if the count is more than 1.

func Prepend

func Prepend(text string, prefix string) string

Prepend prefixes each lines of a string with the given prefix. It can be used to indent or quote (> ) a paragraph, for example.

func RemoveBlank added in v0.8.0

func RemoveBlank(strs []string) []string

RemoveBlank keeps only non-empty strings in the source.

func RemoveDuplicates

func RemoveDuplicates(strings []string) []string

RemoveDuplicates keeps only unique strings in the source.

func SplitLines

func SplitLines(s string) []string

SplitLines splits a string by the newlines character in a portable way Using only `strings.Split(s, "\n")` doesn't work on Windows.

Types

This section is empty.

Jump to

Keyboard shortcuts

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