I had thought about using an array and then splitting it, but it shreds the
string into pieces and removes the delimiter which then has to be added back
to the string in the correct places and replaced at the correct location.
I am able to use this by extending your code as below, but I was hoping
there would be something simpler and possibly more efficient.
Thanks for the example! Is there any way to improve it or the extended
version below?
I took your example and extended it to this:
Dim aString As String
Dim arString() As String
Dim theFinalString as String
Dim i as Integer
aString =
"AAAAAAAAAAAAAAAAAAAA111111BBBBBBBBBBBBBBBBB111111CCCCCCCCCCCCCCCCCCC111111D
DDDDDDDDDDDDDDDDD"
arString = Split(aString,"111111")
For i = 0 to UBound(arString)
If i = 1 then
theFinalString = theFinalString + arString(i) + "222222"
ElseIf i > 1 and i <> UBound(arString) then
theFinalString = theFinalString + arString(i) + "111111"
Else
theFinalString = theFinalString + arString(i)
End If
Next
MsgBox theFinalString
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>