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

Method DiffText1

diffmatchpatch/diff.go:1180–1190  ·  view source on GitHub ↗

DiffText1 computes and returns the source text (all equalities and deletions).

(diffs []Diff)

Source from the content-addressed store, hash-verified

1178
1179// DiffText1 computes and returns the source text (all equalities and deletions).
1180func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string {
1181 //StringBuilder text = new StringBuilder()
1182 var text bytes.Buffer
1183
1184 for _, aDiff := range diffs {
1185 if aDiff.Type != DiffInsert {
1186 _, _ = text.WriteString(aDiff.Text)
1187 }
1188 }
1189 return text.String()
1190}
1191
1192// DiffText2 computes and returns the destination text (all equalities and insertions).
1193func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string {

Callers 6

PatchMakeMethod · 0.95
PatchApplyMethod · 0.95
PatchSplitMaxMethod · 0.95
TestDiffTextFunction · 0.80
TestDiffDeltaFunction · 0.80

Calls 1

StringMethod · 0.45

Tested by 3

TestDiffTextFunction · 0.64
TestDiffDeltaFunction · 0.64