Bonjour,

Je dois créer un programme qui compare deux chaine de caractere entre elle. J'ai trouvé un code C# qui utilise le test de Levenshtein. La traduction en VB proposé sur le site ne fonctionne et je suis débutant en programmation VB Excel. Voici un lien vers le code C# de ce test :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
    * public int LevenshteinValue()
    * {
    * if (this._n == 0) return this._m;
    * else if (this._m == 0) return this._n;
    * else
    * {
    * List<int> lastColumn = new List<int>(this._m);
    * for (int i = 1; i <= this._m; i++) lastColumn.Add(i);
    * int lastValue = 0;
    * int forLastValue = 0;
    *
    * // Get the minimum value
    * for (int j = 1; j <= this._n; j++)
    * {
    * for (int i = 0; i < this._m; i++)
    * {
    * int x = (i == 0 ? j : lastValue) + 1;
    * int y = lastColumn[i] + 1;
    * int z = (i == 0 ? j - 1 : lastColumn[i - 1]) + (this._word1[j - 1] == this._word2[i] ? 0 : 1);
    *
    * forLastValue = lastValue;
    * lastValue = this.Min(x, y, z);
    *
    * if (i > 0) lastColumn[i - 1] = forLastValue;
    * if (i == this._m - 1) lastColumn[i] = lastValue;
    * }
    * }
    * this._levenshtein = lastValue;
    * return this._levenshtein;
    * }
    * }
Si vous avez des solutions je suis tout ouïe!!!
Merci

Mamath