vb 一组数去重复的
发布网友
发布时间:2022-07-14 15:36
我来回答
共2个回答
热心网友
时间:2023-10-21 04:20
下面是去重的,你要把text1的数组都去的话 需要分拆开来可以用split函数。
Private Sub Command1_Click()
Dim s As String, i As Integer, n
n = InputBox("输入要去重")
i = 1
Do While i < Len(n)
n = Mid(n, 1, i) & Replace(Right(n, Len(n) - i), Right(s, 1), "")
i = i + 1
Loop
Debug.Print n
End Sub
热心网友
时间:2023-10-21 04:20
Private Sub Command1_Click()
Dim Ys As String
Dim Ns As String
Dim i As Integer
Dim n As Integer
Ys = Text1.Text
n = Len(Ys)
Ns = Left(Ys, 1)
For i = 2 To n
If InStr(Ns, Mid(Ys, i, 1)) = 0 Then
Ns = Ns & Mid(Ys, i, 1)
End If
Next i
Text2.Text = Ns
End Sub