I have cobbled together the following code that will create a series of strings with a period after each character in sequence:
returning the following series of msgboxes:
a.bcd
ab.cd
abc.d
abcd.
I'm trying to cover all of the possible combinations of characters and periods like:
a.b.cd
a.bc.d
a bcd.
ab.c.d
ab.cd.
abc.d.
a.b.c.d
a.b.cd.
ab.c.d.
etc.
Can someone help me get there?
Thanks,
Sup
Code:
Dim strInput As String
Dim strChar() As String
Dim intLen As Integer, intPos As Integer
Dim i As Integer
Dim strResult As String
strInput = "abcd"
intLen = Len(strInput)
strInput = StrConv(strInput, vbUnicode)
strChar = Split(strInput, vbNullChar)
intPos = 0
For intPos = 0 To intLen - 1
strResult = ""
For i = 0 To UBound(strChar) - 1
If i = intPos Then
strResult = strResult & strChar(i) & "."
Else
strResult = strResult & strChar(i)
End If
Next i
MsgBox strResult
Next intPos
intPos = intPos + 1
returning the following series of msgboxes:
a.bcd
ab.cd
abc.d
abcd.
I'm trying to cover all of the possible combinations of characters and periods like:
a.b.cd
a.bc.d
a bcd.
ab.c.d
ab.cd.
abc.d.
a.b.c.d
a.b.cd.
ab.c.d.
etc.
Can someone help me get there?
Thanks,
Sup