Bonjour,

j'ai besoin de convertir ce code de delphi vers vb6.
Quelqu'un m'aider svp !!!
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
 
 procedure Syllabify(Syllables: TStringList; s: string);
  const
    Consonants   = ['b','B','c','C','d','D','f','F','g','G',
            'h','H','j','J','k','K','l','L','m','M','n','N',
            'ñ','Ñ','p','P','q','Q','r','R','s','S','t','T',
            'v','V','w','W','x','X','y','Y','z','Z'];
    StrongVowels = ['a','A','á','Á','e','E','é','É',
                    'í','Í','o','ó','O','Ó','ú','Ú'];
    WeakVowels   = ['i','I','u','U','ü','Ü'];
    Vowels       = StrongVowels + WeakVowels;
    Letters      = Vowels + Consonants;
  var
    i, j, n, m, hyphen: integer;
  begin
    j := 2;
    s := #0 + s + #0;
    n := Length(s) - 1;
    i := 2;
    Syllables.Clear;
    while i <= n do begin
      hyphen := 0; // Do not hyphenate
      if s[i] in Consonants then begin
        if s[i+1] in Vowels then begin
          if s[i-1] in Vowels then hyphen := 1;
        end else if (s[i] in ['s', 'S']) and (s[i-1] in ['n', 'N'])
             and (s[i+1] in Consonants) then begin
          hyphen := 2;
        end else if (s[i+1] in Consonants) and
                    (s[i-1] in Vowels) then begin
          if s[i+1] in ['r','R'] then begin
            if s[i] in ['b','B','c','C','d','D','f','F','g',
                'G','k','K','p','P','r','R','t','T','v','V']
            then hyphen := 1 else hyphen := 2;
          end else if s[i+1] in ['l','L'] then begin
            if s[i] in ['b','B','c','C','d','D','f','F','g',
                'G','k','K','l','L','p','P','t','T','v','V']
            then hyphen := 1 else hyphen := 2;
          end else if s[i+1] in ['h', 'H'] then begin
            if s[i] in ['c', 'C', 's', 'S', 'p', 'P']
            then hyphen := 1 else hyphen := 2;
          end else
            hyphen := 2;
        end;
      end else if s[i] in StrongVowels then begin
        if (s[i-1] in StrongVowels) then hyphen := 1
      end else if s[i] = '-' then begin
        Syllables.Add(Copy(s, j, i - j));
        Syllables.Add('-');
        inc(i);
        j := i;
      end;
      if hyphen = 1 then begin  // Hyphenate here
        Syllables.Add(Copy(s, j, i - j));
        j := i;
      end else if hyphen = 2 then begin  // Hyphenate after
        inc(i);
        Syllables.Add(Copy(s, j, i - j));
        j := i;
      end;
      inc(i);
    end;
    m := Syllables.Count - 1;
    if (j = n) and (m >= 0) and (s[n] in Consonants) then
      Syllables[m] := Syllables[m] + s[n]   // Last letter
    else
      Syllables.Add(Copy(s, j, n - j + 1)); // Last syllable
  end;
 
 
// To test the procedure yon can drop a Textbox and a Label on a form and
//in the Change event of the Textbox write:
 
  procedure TForm1.Edit1Change(Sender: TObject);
  var
    Syllables: TStringList;
  begin
    Syllables := TStringList.Create;
    try
      Syllabify(Syllables, Edit1.Text);
      Label1.Caption := StringReplace(Trim(Syllables.Text),
        #13#10, '-', [rfReplaceAll]);
    finally
      Syllables.Free;
    end;
  end;