Hey,
This is a pretty nice Pattern-Function for perfect Usernamegenerating/Password's.
c: There is a random consonant (all letters except vowels) generated (uppercase and lowercase letters are differentiated)
v: There is a random vowel (a, e, i, o, u) generated (uppercase and lowercase letters are differentiated)
n: There is a random number generated between 0-9 remaining: All other characters stand for themselves
Code:
Private Const Konsonanten As String = "BCDFGHJKLMNPQRSTVWXYZ"
Private Const Vokale As String = "AEIOU"
Private Const Digits As String = "0123456789"
Private Function cvnpattern(ByVal input As String) As String
Dim r As New Random
Dim sb As New System.Text.StringBuilder
Dim escaped As Boolean = False
For Each c In input
If escaped Then
sb.Append(c)
escaped = False
Else
Select Case c
Case "C"c
sb.Append(Konsonanten(r.Next(0, Konsonanten.Length)))
Case "c"c
sb.Append(Konsonanten(r.Next(0, Konsonanten.Length)).ToString.ToLower)
Case "V"c
sb.Append(Vokale(r.Next(0, Vokale.Length)))
Case "v"c
sb.Append(Vokale(r.Next(0, Vokale.Length)).ToString.ToLower)
Case "N"c
sb.Append(Digits(r.Next(0, Digits.Length)))
Case "n"c
sb.Append(Digits(r.Next(1, Digits.Length)))
Case Else
sb.Append(c)
End Select
End If
Next
Return sb.ToString
End Function
Have fun with it
Greetings JStyler