我想使用库 https://github.com/sergi/go-diff
package main
import (
"fmt"
"github.com/sergi/go-diff/diffmatchpatch"
)
func main() {
dmp := diffmatchpatch.New()
text1 := "some text"
text2 := "other text"
diffs := dmp.DiffMain(text1, text2, true)
fmt.Println(diffs)
}
输出:
[{Delete s} {Equal o} {Delete m} {Insert th} {Equal e} {Insert r} {Equal text}]
我不会:
[{Delete some} {Insert other} {Equal text}]
可能吗?
附言:对不起我的英语。
郎朗坤
相关分类