This is the documentation for the development version.
There are no official binaries for it; build it from the source code in git.
Download links on these pages work only after the release.
For the current release, see version 7.0.
LevenshteinDistance
- LevenshteinDistance(string1, string2, ignoreCase): int
-
Calculates the Levenshtein distance between two strings, which is the minimum number of single-character edits (insertions, deletions, substitutions) needed to transform one string into another.
Table 1. Parameters string1
String
First string to compare
string2
String
Second string to compare
ignoreCase
Boolean
Optional. If TRUE, performs case-insensitive comparison. Defaults to FALSE
ReturnInteger representing the edit distance between the two strings.
// Calculate distance between two strings
distance = LevenshteinDistance("kitten", "sitting");
println(distance); // prints 3
// Case-insensitive comparison
distance = LevenshteinDistance("Hello", "hello", true);
println(distance); // prints 0