MCPcopy Create free account
hub / github.com/sergi/go-diff / DiffText2

Method DiffText2

diffmatchpatch/diff.go:1193–1202  ·  view source on GitHub ↗

DiffText2 computes and returns the destination text (all equalities and insertions).

(diffs []Diff)

Source from the content-addressed store, hash-verified

1191
1192// DiffText2 computes and returns the destination text (all equalities and insertions).
1193func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {
1194 var text bytes.Buffer
1195
1196 for _, aDiff := range diffs {
1197 if aDiff.Type != DiffDelete {
1198 _, _ = text.WriteString(aDiff.Text)
1199 }
1200 }
1201 return text.String()
1202}
1203
1204// DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
1205func (dmp *DiffMatchPatch) DiffLevenshtein(diffs []Diff) int {

Callers 4

PatchApplyMethod · 0.95
PatchSplitMaxMethod · 0.95
TestDiffTextFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 2

TestDiffTextFunction · 0.64