VBS版的,稍调试就是VB6版的。
TestStr = "abcd、3、、abcd、"
Result = ""
For i = 1 To Len(TestStr)
If InStr(1, Result, Mid(TestStr, i, 1), 1) > 0 Then
TestStr = Replace(TestStr, Mid(TestStr, i, 1), "")
'MsgBox TestStr
Else
Result = Result + Mid(TestStr, i, 1)
End If
Next
MsgBox Result
MyTest = ""
For k = 1 To Len(Result)
resk = Mid(Result, k, 1)
Value = 0
For t = 1 To Len(TestStr)
Rest = Mid(TestStr, t, 1)
If resk = Rest Then
Value = Value + 1
End If
Next
MyTest = MyTest & "字符串为" & resk & " 次数为:" & Value & vbCrLf
Next
MsgBox MyTest