textpatch

package
v0.17.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package textpatch applies ordered exact search-replace pairs to a text atomically: each pair's Old must match exactly once in the text as it stands when that pair applies, pairs apply in sequence, and the first failing pair aborts the whole application (20260826-120330-d-tac-8f8).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(text string, pairs []Pair) (string, error)

Apply returns text with every pair applied in order, or an error naming the first failing pair — Old empty, absent, or matching more than once. On error the input text is unchanged by contract: nothing partial escapes.

Types

type Pair

type Pair struct {
	Old string
	New string
}

Pair is one exact search-replace edit.

Jump to

Keyboard shortcuts

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