Just for fun, I wanted to see how else the function could be written. The first attempt I made was to use as few lines as possible to write the code. The second attempt was to write the function recursively. Granted the least amount of code version is not very maintenance friendly and the recursive one is most definitely the poorest performer.
Here's what I came up with.
Private Function StripIt(strText As String) As String
Dim intOffset As Integer
For intOffset = 1 To Len(strText)
StripIt = StripIt & IIf(Mid$(strText, intOffset, 1) = Mid$(strText, intOffset + 1, 1), _
"", Mid$(strText, intOffset, 1))
Next intOffset
End Function
Private Function StripItRec(strText As String) As String
Dim strReturnString As String
If Len(strText) = 1 Then
StripItRec = strText
Else
strReturnString = StripItRec(Mid$(strText, 2))
StripItRec = IIf(Left$(strReturnString, 1) = Left$(strText, 1), _
strReturnString, _
Left$(strText, 1) & strReturnString)
End If
End Function
Snaggs
tribesaddict@swbell.net