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
|
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim chaine As String
chaine = InputBox("chaine à listcaser ?")
TextBox1.Text = ""
Dim strB, strB2 As New System.Text.StringBuilder
listecase(strB, chaine)
For Each a As String In liste
TextBox1.Text = TextBox1.Text & a & vbCrLf
Next
End Sub
Private liste As New Collection
Private Sub listecase(ByVal strB As System.Text.StringBuilder, ByVal chaine_restante As String)
If chaine_restante.Length = 0 Then
liste.Add(strB.ToString)
Else
Dim a As New System.Text.StringBuilder
a.Append(strB.ToString)
Dim b As New System.Text.StringBuilder
b.Append(strB.ToString)
Debug.Print(a.ToString)
a.Append(LCase(chaine_restante.Chars(0)))
listecase(a, Microsoft.VisualBasic.Right(chaine_restante, Len(chaine_restante) - 1))
Debug.Print(b.ToString)
b.Append(UCase(chaine_restante.Chars(0)))
listecase(b, Microsoft.VisualBasic.Right(chaine_restante, Len(chaine_restante) - 1))
End If
End Sub |
Partager