replacer

package
v0.0.0-...-5321e6f Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Provider is the name of the default provider to use.
	Provider string `config:"provider"`
	// QuoteReplacements will quote replacement values.
	QuoteReplacements bool `config:"escape_replacements"`
	// IgnoreUnknownKeys will ignore unknown replacement keys.
	IgnoreUnknownKeys bool `config:"ignore_unknown_keys"`
}

Config holds global replacer configuration options.

type Replacer

type Replacer struct {
	// contains filtered or unexported fields
}

Replacer performs replacement on strings using various providers.

func New

func New(cfg map[string]string) (*Replacer, error)

New creates a new replacer with the given config.

func (*Replacer) ReplaceAll

func (r *Replacer) ReplaceAll(s string) (string, error)

ReplaceAll replaces all replacement tags in the given string with values from the corresponding providers.

Jump to

Keyboard shortcuts

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