vb 字符串重复问题
发布网友
发布时间:2024-05-14 17:35
我来回答
共2个回答
热心网友
时间:2024-05-29 06:35
给你写个思路,供你参考:
Private Sub Command1_Click()
Dim a(1 To 3) As Integer, b(1 To 4) As Integer, c(1 To 3) As Integer
Dim i As Integer, s As Integer, t As Integer, d As String, temp As Integer, te As Integer
a(1) = 1: a(2) = 2: a(3) = 3
b(1) = 5: b(2) = 8: b(3) = 9: b(4) = 0
c(1) = 4: c(2) = 6: c(3) = 7
s = 184
temp = s
t = 0
Do While temp <> 0
te = temp Mod 10
temp = temp \ 10
For i = 1 To 3
If te = a(i) Then
t = t + 1
Exit For
End If
Next i
Loop
If t <> 0 Then
d = d + Trim(Str(t)) + "aa"
End If
temp = s
t = 0
Do While temp <> 0
te = temp Mod 10
temp = temp \ 10
For i = 1 To 4
If te = b(i) Then
t = t + 1
Exit For
End If
Next i
Loop
If t <> 0 Then
d = d + Trim(Str(t)) + "bb"
End If
temp = s
t = 0
Do While temp <> 0
te = temp Mod 10
temp = temp \ 10
For i = 1 To 3
If te = c(i) Then
t = t + 1
Exit For
End If
Next i
Loop
If t <> 0 Then
d = d + Trim(Str(t)) + "cc"
End If
Debug.Print d
End Sub
热心网友
时间:2024-05-29 06:38
描述不清楚........判断s当中的数字都和那几组重复了并算出重复个数然后重复组的名称
定义aa bb........???