go4.org: go4.org/bytereplacer Index | Files

package bytereplacer

import "go4.org/bytereplacer"

Package bytereplacer provides a utility for replacing parts of byte slices.


Package Files


type Replacer Uses

type Replacer struct {
    // contains filtered or unexported fields

Replacer replaces a list of strings with replacements. It is safe for concurrent use by multiple goroutines.

func New Uses

func New(oldnew ...string) *Replacer

New returns a new Replacer from a list of old, new string pairs. Replacements are performed in order, without overlapping matches.

func (*Replacer) Replace Uses

func (r *Replacer) Replace(s []byte) []byte

Replace performs all replacements in-place on s. If the capacity of s is not sufficient, a new slice is allocated, otherwise Replace returns s.

Package bytereplacer imports 1 packages (graph) and is imported by 2 packages. Updated 2019-10-07. Refresh now. Tools for package owners. This is an inactive package (no imports and no commits in at least two years).