真正抢分问题!!

hzc1 2005-07-14 10:53:50
我想将一字符串A与一字符串B相与,得到剩下的值,有没有什么函数可以解决。
如:A=(“1,2,3,4,5,6,7,8,9”)B=(“2,5,6,7”)我要得到的结果是C=(“1,3,4,8,9”)
谢谢了!
...全文
127 点赞 收藏 6
写回复
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
bwldwb6 2005-07-14
人家都解决了还抢什么分啊
喝点人家的残羹剩汁吧
回复
greentest 2005-07-14
嘿嘿,抢分
回复
zhzhq800204 2005-07-14
Private Sub Command1_Click()
a = "1,2,3,4,5,6,7,8,9"
b = "2,5,6,7"
c = ""
Dim x() As String, y() As String
Dim k As Integer
x = Split(a, ",")
n = UBound(x)
y = Split(b, ",")
m = UBound(y)

For i = 0 To n
k = InStr(1, b, x(i))

If k = 0 Then
If Len(c) = 0 Then
c = c & x(i)
Else
c = c & "," & x(i)
End If
End If
Next i
Text1.Text = c
End Sub
答案:
c = "1,3,4,8,9"
回复
jxgzay 2005-07-14
C=A-B
(集合的差)
回复
jxgzay 2005-07-14
Private Sub Command1_Click()
a = "1,2,3,4,5,6,7,8,9"
b = "2,5,6,7"
c = ""
Dim x() As String, y() As String

x = Split(a, ",")
n = UBound(x)
y = Split(b, ",")
m = UBound(y)

For i = 0 To n
tj = 0

For j = 0 To m
If x(i) = y(j) Then
tj = 1
End If
Next

If tj = 0 Then
If Len(c) = 0 Then
c = x(i)
Else
c = c & "," & x(i)
End If
End If
Next
Print c
End Sub
答案:
c="1,3,4,8,9"



回复
ilove8 2005-07-14
up
回复
发动态
发帖子
VB基础类
创建于2007-09-28

7451

社区成员

VB 基础类
申请成为版主
社区公告
暂无公告