strfun

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2024 License: EUPL-1.2 Imports: 5 Imported by: 0

Documentation

Overview

Package strfun provides some string functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JustifyLeft

func JustifyLeft(s string, maxLen int, pad rune) string

JustifyLeft ensures that the string has a defined length.

func Length

func Length(s string) int

Length returns the number of runes in the given string.

func MakeWords added in v0.13.0

func MakeWords(text string) []string

MakeWords produces a list of words, i.e. string that were separated by control character, space characters, or separator characters.

func NormalizeWords

func NormalizeWords(s string) (result []string)

NormalizeWords produces a word list that is normalized for better searching.

func Slugify

func Slugify(s string) string

Slugify returns a string that can be used as part of an URL

func SplitLines

func SplitLines(s string) []string

SplitLines splits the given string into a list of lines.

func XMLEscape added in v0.5.0

func XMLEscape(w io.Writer, s string)

XMLEscape writes the string to the given writer, where every rune that has a special meaning in XML is escaped.

Types

type Set added in v0.5.0

type Set map[string]struct{}

Set ist a set of strings.

func NewSet added in v0.5.0

func NewSet(values ...string) Set

NewSet creates a new set from the given values.

func (Set) Has added in v0.5.0

func (s Set) Has(v string) bool

Has returns true, if given value is in set.

func (Set) Set added in v0.5.0

func (s Set) Set(v string)

Set adds the given string to the set.

Jump to

Keyboard shortcuts

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