DiffText1 computes and returns the source text (all equalities and deletions).
(diffs []Diff)
| 1195 | |
| 1196 | // DiffText1 computes and returns the source text (all equalities and deletions). |
| 1197 | func (dmp *DiffMatchPatch) DiffText1(diffs []Diff) string { |
| 1198 | //StringBuilder text = new StringBuilder() |
| 1199 | var text bytes.Buffer |
| 1200 | |
| 1201 | for _, aDiff := range diffs { |
| 1202 | if aDiff.Type != DiffInsert { |
| 1203 | _, _ = text.WriteString(aDiff.Text) |
| 1204 | } |
| 1205 | } |
| 1206 | return text.String() |
| 1207 | } |
| 1208 | |
| 1209 | // DiffText2 computes and returns the destination text (all equalities and insertions). |
| 1210 | func (dmp *DiffMatchPatch) DiffText2(diffs []Diff) string { |