I have checked diff, but the result, at least for me, is useless since I can't read on which place the delete/change/insert operation occurs
import experimental/diff
var
x = "apple"
y = "Apple!"
echo x
echo y
echo diff.diffText(x, y)
outputs
@[(startA: 0, startB: 0, deletedA: 1, insertedB: 1)]
so is there something like https://github.com/edg2s/google-diff-match-patch or https://docs.python.org/3/library/difflib.html
BTW, https://github.com/edg2s/google-diff-match-patch abandoned C++ version, which requires the Qt library, long time ago.
thanks
I think my port of that same Py difflib algo is a bit tidier and also quite a bit faster: https://github.com/c-blake/hldiff
In the near future (whenever duplicate keys in std/tables.Table move from deprecated to gone - a move I still consider better resolved through documentation improvements), this will grow a package dependency on https://github.com/c-blake/adix
thanks. but how to take space into account. For
a = "the quick brown fox jumped over the lazy dogs"
b = "quic k brown fox jumped over the very busy dogs"
please note that there are 2 spaces between fox and jumped in b. what I expected is that space is treated too. so the result I expected is something like, where I use ␣ for space display, and to be clear, I do not show aStart/aEnd/bStart/bEnd, on the other hand I use text directly
delete a: the␣
equal: quic
insert b: ␣
euqal: k␣brown␣fox␣
insert b: ␣
equal: jumped␣over␣the
replace a: laz
replace b: very␣bus
equal: y dogs