bytereplacer

package
Version: v0.0.0-...-d4a0794 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2020 License: Apache-2.0 Imports: 1 Imported by: 4

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Replacer

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

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

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.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto