mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
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.
21 lines
787 B
Plaintext
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 → a string<br />
|
|
string2 → a string<br />
|
|
|
|
<h4>Example</h4>
|
|
<pre> levenshtein('kittens','mitten') → 2</pre><br />
|
|
<pre> levenshtein('Kitten','kitten') → 1</pre><br />
|
|
<pre> levenshtein(upper('Kitten'),upper('kitten')) → 0</pre>
|
|
|