string_difference |
Discworld driver help |
string_difference |
Name
string_difference() - Measures the difference between two strings.
Synopsis
int string_difference( string a, string b );
Description
string_difference() returns the Levenshtein distance between the strings `a' and `b'. This is defined as the minimal number of operations required to transform `a' into `b', where the operations allowed are 1) deletion of a single character, 2) insertion of a single character, and 3) changing one character into a different character. Thus, the lower number string_difference() returns, the more similar the two strings are.
Properties
string_difference( a, b ) == 0 if and only if a == b
string_difference( a, b ) has a lower bound in the difference in string lengths between `a' and `b', and an upper bound in the string length of the longest of `a' and `b'.