Function StrDiff() Foundation

Calculates the similarity of two strings (Levenshtein distance)

Syntax
StrDiff( <cString1>        , ;
         <cString2>        , ;
         [<nReplaceWeight>], ;  // Default: 3
         [<nDeleteWeight>] , ;  // Default: 6
         [<nInsertWeight>]   ;  // Default: 1
       ) --> nSimilarity
Return

Returns a numeric value which indicates the similarity of two strings. The lesser the value is the more similar are the strings.

Description

The underlying algorithm of StrDiff() weighs the operations REPLACE, DELETE and INSERT which are needed to make two strings equal. By default the operation DELETE is the "most expensive" one and has the highest weighing factor. The function checks which operations are needed to make the two passed strings equal and adds the factors for the required operations. The sum of the weighing factors for the required operations is returned.

Feedback

If you see anything in the documentation that is not correct, does not match your experience with the particular feature or requires further clarification, please use this form to report a documentation issue.