Arrangement, permutation, combinaison lettres Alphabet

Bonjour,

Avec 32 lettres, forcément !

Sub CompterDoublons()

    Dim Tbl() As String
    Dim I As Integer

    Tbl() = LettresDoublon("ACIMPRUZAHOVDLTBEGJNQSVZBEFKMWXY")

    Debug.Print UBound(Tbl); "doublons :"

    For I = 1 To UBound(Tbl): Debug.Print Tbl(I): Next I

End Sub

Function LettresDoublon(Chaine As String) As String()

    Dim Dico As Object
    Dim Tbl() As String
    Dim I As Integer
    Dim J As Integer

    Set Dico = CreateObject("Scripting.Dictionary")

    For I = 1 To Len(Chaine)

        If Dico.Exists(Mid(Chaine, I, 1)) = False Then

            Dico.Add Mid(Chaine, I, 1), ""

        Else

            J = J + 1: ReDim Preserve Tbl(1 To J)
            Tbl(J) = Mid(Chaine, I, 1)

        End If

    Next I

    LettresDoublon = Tbl()

End Function
Rechercher des sujets similaires à "arrangement permutation combinaison lettres alphabet"