Levenshtein ( str1 ; str2 ; damerau ; caseSensitive )
Finds the Levenshtein or Damerau-Levenshtein distance between two strings.
Average rating: 3.5 (72 votes) Log in to vote
|
Steve Allen Richard Carlton Consulting, Inc. http://www.rcconsulting.com |
Function definition: (Copy & paste into FileMaker's Edit Custom Function window)
Finds the Levenshtein or Damerau-Levenshtein distance between two strings, as described at:
http://en.wikipedia.org/wiki/Levenshtein_distance
http://en.wikipedia.org/wiki/Damerau–Levenshtein_distance
(both pages accessed January 29, 2009 at 4:00 p.m.)
Note: best viewed in a large text space, or at least without word wrap, for formatting reasons.
Comments
| Mrlaura Oct 11, 2026 |
||
| Thanks, Steve, for sharing this FileMaker implementation and documenting the array-indexing approach. One small issue I noticed: with `pad = "000"`, each matrix coordinate can only represent values from 0 to 999, rather than allowing strings up to 999,999 characters as described. For example, `Right("000" & 1000; 3)` returns `"000"`, causing coordinate 1000 to collide with coordinate 0. I'd suggest adding a length check to reject unsupported inputs, or increasing the padding width if longer strings are required. The same change would need to be applied consistently across the helper functions. This reference discusses implementation correctness and memory considerations: https://www.levenshtein.net/levenshtein-implementations For transparency, I contribute to the linked reference. Thanks again for making this implementation available! |
||
| Mrlaura Oct 11, 2026 |
||
| Thanks, Steve, for sharing this FileMaker implementation and documenting the array-indexing approach. One small issue I noticed: with `pad = "000"`, each matrix coordinate can only represent values from 0 to 999, rather than allowing strings up to 999,999 characters as described. For example, `Right("000" & 1000; 3)` returns `"000"`, causing coordinate 1000 to collide with coordinate 0. I'd suggest adding a length check to reject unsupported inputs, or increasing the padding width if longer strings are required. The same change would need to be applied consistently across the helper functions. This reference on Levenshtein implementation correctness and performance discusses related considerations. For transparency, I contribute to the linked reference. Thanks again for making this implementation available! |
||
Note: these functions are not guaranteed or supported by BrianDunning.com. Please contact the individual developer with any questions or problems.