Add JsonPrint, StringMissing

This commit is contained in:
George Suntres
2026-04-18 19:40:51 -04:00
parent f52793a764
commit 1298398922
6 changed files with 112 additions and 2 deletions

View File

@@ -6,6 +6,8 @@ import (
"golang.org/x/text/cases"
"golang.org/x/text/language"
"github.com/sergi/go-diff/diffmatchpatch"
)
var caserTitle cases.Caser = cases.Title(language.English, cases.NoLower)
@@ -32,3 +34,19 @@ func StringIsBlank(s string) bool {
func StringIsNotBlank(s string) bool {
return !StringIsBlank(s)
}
func StringMissing(a, b string) string {
dmp := diffmatchpatch.New()
diffs := dmp.DiffMain(a, b, false)
var missing string
for _, d := range diffs {
if d.Type == diffmatchpatch.DiffDelete {
missing += d.Text
}
}
return missing
}