This my Answer to the stackoverflow question: How to detect duplicate data?:

You can compare the names with the Levenshtein distance. If the names are the same, the distance is 0, else it is given by the minimum number of operations needed to transform one string into the other.