strings

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 1 Imported by: 26

Documentation

Overview

Package strings provides string manipulation utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContainsAnyOf

func ContainsAnyOf(str string, args ...string) bool

ContainsAnyOf returns whether the given string contains any of the following strings.

func EnglishJoin

func EnglishJoin(words []string, oxfordComma bool) string

EnglishJoin joins a slice of strings with commas and the "and" conjugation before the final item. The Oxford comma can optionally be applied.

Example:

str := EnglishJoin([]string{"meow", "purr", "raow"}, true)
fmt.Println(str) // meow, purr, and raow

func SpokenLanguageJoin

func SpokenLanguageJoin(words []string, language Language) string

SpokenLanguageJoin joins a slice of strings with commas and a conjunction before the final item. You may specify the language with Language.

If you are using English and need the Oxford Comma, use EnglishJoin.

Example:

str := SpokenLanguageJoin([]string{"eins", "zwei", "drei"}, DE)
fmt.Println(str) // eins, zwei und drei

Types

type Language

type Language int

Language is a spoken Language.

const (
	DE Language = iota
	DK
	EN
	ES
	FR
	IT
	NO
	PT
	SE
)

Available spoken lanaguges.

func (Language) String

func (l Language) String() string

String returns the English name of the Language code.

Jump to

Keyboard shortcuts

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