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

Method DiffText2

diffmatchpatch/diff.go:1210–1219  ·  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

1208
1209// DiffText2 computes and returns the destination text (all equalities and insertions).
1210func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {
1211 var text bytes.Buffer
1212
1213 for _, aDiff := range diffs {
1214 if aDiff.Type != DiffDelete {
1215 _, _ = text.WriteString(aDiff.Text)
1216 }
1217 }
1218 return text.String()
1219}
1220
1221// DiffLevenshtein computes the Levenshtein distance that is the number of inserted, deleted or substituted characters.
1222func (dmp *DiffMatchPatch) DiffLevenshtein(diffs []Diff) int {

Callers 5

PatchApplyMethod · 0.95
PatchSplitMaxMethod · 0.95
TestDiffTextFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 3

TestDiffTextFunction · 0.64