5个回答
展开全部
重新改过的程序,这次没什么问题了(主要是之前没有理解你的意图):
strSrc = "6,8,6,6,6,6,8,6,6,6,5,6,6,10,10,6,8,6,11,7,7,10,"
strSch = "6,6,"
strPartSrc = Split(strSrc,",")
strPartSch = Split(strSch,",")
strDes = ""
For i = 0 To (UBound(strPartSrc)-UBound(strPartSch))
strFind = ""
For j = 0 To (UBound(strPartSch)-1)
strFind = strFind & strPartSrc(i+j)& ","
Next
'MsgBox strFind
If strFind = strSch Then
strDes = strDes & strPartSrc(i+2) & ","
End If
Next
msgbox strDes
strSrc = "6,8,6,6,6,6,8,6,6,6,5,6,6,10,10,6,8,6,11,7,7,10,"
strSch = "6,6,"
strPartSrc = Split(strSrc,",")
strPartSch = Split(strSch,",")
strDes = ""
For i = 0 To (UBound(strPartSrc)-UBound(strPartSch))
strFind = ""
For j = 0 To (UBound(strPartSch)-1)
strFind = strFind & strPartSrc(i+j)& ","
Next
'MsgBox strFind
If strFind = strSch Then
strDes = strDes & strPartSrc(i+2) & ","
End If
Next
msgbox strDes
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
dim strDes as string
dim strSrc as String
dim strSrch as String
Dim lPos as long
strSrc=文本框1.Text
strSrch=文本框2.Text
strDes=""
lPos=Instr(strSrc,strSrch)
while lPos<>0
lPos=lPos+len(strSrch)
strDes=strDes & Mid(strSrc,lPos,1) & ","
lPos=instr(lPos,strSrc,strSrch)
wend
文本框1.Text=strDes
'=============================
上边的代码刚漏掉一个逗号,根据要求重新调整,以下代码经过测试:
Dim strDes As String
Dim strSrc As String
Dim strSrch As String
Dim lPos As Long
Dim lTmp As Long
strSrc = 文本框1.Text
strSrch = 文本框2.Text
strDes = ""
lPos = InStr(strSrc, strSrch)
While lPos <> 0
lPos = lPos
lTmp = InStr(lPos + Len(strSrch) + 1, strSrc, ",")
strDes = strDes & Mid(strSrc, lPos + Len(strSrch) + 1, lTmp - lPos - Len(strSrch) - 1) & ","
lPos = InStr(lPos + 1, strSrc, strSrch)
Wend
文本框3.Text = strDes
dim strSrc as String
dim strSrch as String
Dim lPos as long
strSrc=文本框1.Text
strSrch=文本框2.Text
strDes=""
lPos=Instr(strSrc,strSrch)
while lPos<>0
lPos=lPos+len(strSrch)
strDes=strDes & Mid(strSrc,lPos,1) & ","
lPos=instr(lPos,strSrc,strSrch)
wend
文本框1.Text=strDes
'=============================
上边的代码刚漏掉一个逗号,根据要求重新调整,以下代码经过测试:
Dim strDes As String
Dim strSrc As String
Dim strSrch As String
Dim lPos As Long
Dim lTmp As Long
strSrc = 文本框1.Text
strSrch = 文本框2.Text
strDes = ""
lPos = InStr(strSrc, strSrch)
While lPos <> 0
lPos = lPos
lTmp = InStr(lPos + Len(strSrch) + 1, strSrc, ",")
strDes = strDes & Mid(strSrc, lPos + Len(strSrch) + 1, lTmp - lPos - Len(strSrch) - 1) & ","
lPos = InStr(lPos + 1, strSrc, strSrch)
Wend
文本框3.Text = strDes
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim myPos As Integer, myStr As String, myStrEnd As Integer
myPos = 1
Do
myPos = InStr(myPos, Text1.Text, Text2.Text)
myStrEnd = InStr(myPos + Len(Text2.Text) + 1, Text1.Text, ",")
If myPos = 0 Or myStrEnd = 0 Then Exit Do
myStr = myStr & Mid(Text1.Text, myPos + Len(Text2.Text), myStrEnd - (myPos + Len(Text2.Text))) & ","
myPos = myPos + 1
Loop
Text3.Text = myStr
myPos = 1
Do
myPos = InStr(myPos, Text1.Text, Text2.Text)
myStrEnd = InStr(myPos + Len(Text2.Text) + 1, Text1.Text, ",")
If myPos = 0 Or myStrEnd = 0 Then Exit Do
myStr = myStr & Mid(Text1.Text, myPos + Len(Text2.Text), myStrEnd - (myPos + Len(Text2.Text))) & ","
myPos = myPos + 1
Loop
Text3.Text = myStr
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2009-05-29
展开全部
不理解意图,看不出来规律。。。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询