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

Function ExampleDiffMatchPatch_DiffText1

diffmatchpatch/example_test.go:40–51  ·  view source on GitHub ↗

The diffs are plain data; the source and target texts can be reconstructed from them without any pretty printing.

()

Source from the content-addressed store, hash-verified

38// The diffs are plain data; the source and target texts can be
39// reconstructed from them without any pretty printing.
40func ExampleDiffMatchPatch_DiffText1() {
41 dmp := diffmatchpatch.New()
42
43 diffs := dmp.DiffMain("Hello world.", "Hello goodbye world.", false)
44
45 fmt.Println("source:", dmp.DiffText1(diffs))
46 fmt.Println("target:", dmp.DiffText2(diffs))
47
48 // Output:
49 // source: Hello world.
50 // target: Hello goodbye world.
51}
52
53// Diff two texts line by line by reducing each line to a character,
54// diffing the reduced texts and expanding the result back to lines.

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
DiffMainMethod · 0.80
DiffText1Method · 0.80
DiffText2Method · 0.80

Tested by

no test coverage detected