Nyall Dawson feb3bee858 Add a bunch of optimised fuzzy string matching algorithms.
A new QgsStringUtils class has been added containing some
common fuzzy matching algorithms, including Levenshtein edit
distance and Soundex. These can be used for finding "similar"
strings in a table.

Expression functions for these algorithms have also been
added to a new "Fuzzy Matching" group.
2015-06-27 11:51:56 +10:00

21 lines
787 B
Plaintext

<h3>levenshtein function</h3>
Returns the Levenshtein edit distance between two strings. This equates to the minimum
number of character edits (insertions, deletions or substitutions) required to change
one string to another.<br />
The Levenshtein distance is a measure of the similarity between two strings. Smaller
distances mean the strings are more similar, and larger distances indicate more
different strings. The distance is case sensitive.
<h4>Syntax</h4>
<pre>levenshtein(string1,string2)</pre>
<h4>Arguments</h4>
string1 &rarr; a string<br />
string2 &rarr; a string<br />
<h4>Example</h4>
<pre> levenshtein('kittens','mitten') &rarr; 2</pre><br />
<pre> levenshtein('Kitten','kitten') &rarr; 1</pre><br />
<pre> levenshtein(upper('Kitten'),upper('kitten')) &rarr; 0</pre>