utils

package
v0.0.0-...-d2214c1 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func CondenseAcronyms

func CondenseAcronyms(parts *[]string, options ...CondenseOptFunc)
Example
var parts = []string{"abc", "a", "b", "c", "abc"}
CondenseAcronyms(&parts, WithAcronymMap(map[string]struct{}{"abc": {}}))
fmt.Println(parts)
Output:

[abc abc abc]

func RemoveAccents

func RemoveAccents(s string) string
Example
fmt.Println(RemoveAccents("Pokémon"))
Output:

Pokemon

func SplitByUpper

func SplitByUpper(s string) []string
Example
fmt.Println(SplitByUpper("abcABCAbc"))
Output:

[abc a b c abc]

Types

type CondenseOptFunc

type CondenseOptFunc func(o *condenseOpts)

func WithAcronymMap

func WithAcronymMap(acronyms map[string]struct{}) CondenseOptFunc

func WithAfter

func WithAfter(condenseAfterIdx int) CondenseOptFunc
Example
var o condenseOpts
WithAfter(0)(&o)
fmt.Println(o)
Output:

{map[] 0}

Jump to

Keyboard shortcuts

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