路过,花时间写了个来支持。- Dim s '源字符串
- Dim final '最终字符串
- Dim ss,i,j
-
- s="bat home home Net home net Bat net"
- 'For i=0 To 10
- ' s=s & " " & s
- 'Next
- ss=Split(s," ")
- MsgBox "Length: " & Len(s) & vbNewLine & "Count: " & UBound(ss)+1
- ReDim mark(UBound(ss))
- For i=0 To UBound(ss)-1
- If (mark(i)=0) Then
- For j=i+1 To UBound(ss)
- If (mark(j)=0) Then
- If (StrComp(ss(i),ss(j),vbTextCompare)=0) Then
- mark(i)=1:mark(j)=-1
- End If
- End If
- Next
- End if
- Next
- For i=0 To UBound(ss)
- If (mark(i)=1) Then final=final & ss(i) & " "
- Next
- If (Len(final)>0) Then final=Left(final,Len(final)-1)
- Erase mark
-
- MsgBox final
复制代码
|