我想使用庫 https://github.com/sergi/go-diffpackage mainimport ( "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}]可能嗎?附言:對不起我的英語。
1 回答

郎朗坤
TA貢獻1921條經驗 獲得超9個贊
檢查這個
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(dmp.DiffCleanupSemantic(diffs))
}
添加回答
舉報
0/150
提交
取消