distance

fun distance(first: CharSequence, second: CharSequence, limit: Int = Int.MAX_VALUE): Int

The Levenshtein distance, or edit distance, between two words is the minimum number of single-character edits (insertions, deletions or substitutions) required to change one word into the other.

It is always at least the difference of the sizes of the two strings. It is at most the length of the longer string. It is 0 if and only if the strings are equal.

Return

the computed Levenshtein distance.

Parameters

first

first string to compare.

second

second string to compare.

limit

the maximum result to compute before stopping, terminating calculation early.