I am trying to count number of a changes on one field ( one string ) with javascript. For example on name= MARTIN : MARTI => 1 change MARTINE => 1 change MATRIN => 2 changes MARBOM => 3 changes
Asked
Active
Viewed 121 times
0
-
2Why is "marbon" 3 changes? Only "b" and "o" have changed. – JJJ May 29 '13 at 07:17
-
N is not a change it was here before – lc2817 May 29 '13 at 07:22
-
Considering the example name : he is 'MARBOM' not 'MARBON' so the changes are 3 :) – Pavel Kenarov May 29 '13 at 08:23
1 Answers
6
This is called the levenshtein distance, use that: http://www.dzone.com/snippets/javascript-implementation

lc2817
- 3,722
- 16
- 40