Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Comparing Two Strings producing a numeric delta

Does anyone know of a simple way to compare two strings together to generate the "amount of difference" between the two? (in a numeric value) I have been crawling google with little luck on this. And after doing some coding it's not as simple as I had thought. Any clues?

like image 842
Adam Driscoll Avatar asked Mar 02 '23 06:03

Adam Driscoll


2 Answers

Are you talking about the "Edit Distance"? Do a search on "Levenshtein Distance", on SO or Google. I use the version posted on Stephen Toub's blog

like image 113
Danimal Avatar answered Mar 03 '23 22:03

Danimal


You're looking for the Levenshtein distance.

like image 40
Bill the Lizard Avatar answered Mar 03 '23 22:03

Bill the Lizard