https://kotlinlang.org logo
r

Rob Murdock

02/10/2020, 3:30 PM
quick general question - is there a good tiny library for getting a human readable representation of the difference between two strings?
My search-jitsu is not producing results this morning
l

Luca Clemente Gonzalez

02/10/2020, 3:50 PM
I’m interested in that too. I have to clean duplicates of a lot of data. It would be nice to have any library that can help me find similar strings
s

Sylux

02/10/2020, 4:24 PM
r

Rob Murdock

02/10/2020, 4:25 PM
Yep! But available in multiplatform kotlin 🤷.
😥 1
l

louiscad

02/10/2020, 4:57 PM
It seems like it's yet to be done. J2K might help do it though as there's a Java impl in linked Google's repo.
e

elizarov

02/10/2020, 5:04 PM
I just recently wrote a pure-Kotlin implementation of Myers greedy algorithm to compute the difference between two sets of lines, though it can only compute small differences (<= 100 lines) reasonably fast. Feel free to copy-paste it and adapt for your needs (it has Apache 2.0 license): https://github.com/Kotlin/kotlinx-knit/blob/master/kotlinx-knit-test/src/KnitDiff.kt
👍 3
r

Rob Murdock

02/10/2020, 5:05 PM
Huh, nice! Thanks Roman. 🙂
3 Views