nstrings

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2019 License: MIT Imports: 2 Imported by: 10

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ReplacerToUpper is a replacer which replaces lower cases by upper cases
	ReplacerToUpper = ReplacerFunc(func(s string) string {
		return strings.ToUpper(s)
	})
	// ReplacerToLower is a replacer which replaces upper cases to lower cases
	ReplacerToLower = ReplacerFunc(func(s string) string {
		return strings.ToLower(s)
	})
	// ReplacerTrimSpace is a replacer which removes spaces
	ReplacerTrimSpace = ReplacerFunc(func(s string) string {
		return strings.Trim(s, " ")
	})
)

Functions

This section is empty.

Types

type Replacer

type Replacer interface {
	Replace(s string) string
	WriteString(w io.Writer, s string) (n int, err error)
}

Replacer is an interface to characters of a string

type ReplacerFunc

type ReplacerFunc func(s string) string

ReplacerFunc is a function which implements the Replacer interface

func (ReplacerFunc) Replace

func (f ReplacerFunc) Replace(s string) string

Replace runs f

func (ReplacerFunc) WriteString

func (f ReplacerFunc) WriteString(w io.Writer, s string) (n int, err error)

WriteString writes to w the string s with replacement applied by f

Jump to

Keyboard shortcuts

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