编写过程DeleStr(s1,s2),将字符串s1中出现的字符串s2删去,结果仍存放在s1中.
PrivateFunctiondelestr(s1AsString,ByVals2AsString)AsStringDimsAsString,m%,n%,k%m=Len(...
Private Function delestr(s1 As String, ByVal s2 As String) As String
Dim s As String, m%, n%, k%
m = Len(s2)
Do While InStr(s1, s2) > 0
k = Len(s1)
n = InStr(s1, s2)
s = Left(s1, n - 1) + Mid(s1, n + m, k - m - n + 1)
s1 = s
Loop
End Function
Private Sub Form_Click()
Dim s1 As String, s2 As String, s As String
s1 = Text1.Text
s2 = Text2.Text
s = delestr(s1, s2)
Text3.Text = s
End Sub
没有反应 哪里有问题 展开
Dim s As String, m%, n%, k%
m = Len(s2)
Do While InStr(s1, s2) > 0
k = Len(s1)
n = InStr(s1, s2)
s = Left(s1, n - 1) + Mid(s1, n + m, k - m - n + 1)
s1 = s
Loop
End Function
Private Sub Form_Click()
Dim s1 As String, s2 As String, s As String
s1 = Text1.Text
s2 = Text2.Text
s = delestr(s1, s2)
Text3.Text = s
End Sub
没有反应 哪里有问题 展开
1个回答
展开全部
Private Sub DeleStr(ByVal s1 As String, ByVal s2 As String)
Dim i%, ls1%, ls2%
i = InStr(s1, s2)
ls2 = Len(s2)
Do While i > 0
ls1 = Len(s1)
s1 = Left(s1, i - 1) + Mid(s1, i + ls2)
i = InStr(s1, s2)
Loop
End Sub
Dim i%, ls1%, ls2%
i = InStr(s1, s2)
ls2 = Len(s2)
Do While i > 0
ls1 = Len(s1)
s1 = Left(s1, i - 1) + Mid(s1, i + ls2)
i = InStr(s1, s2)
Loop
End Sub
追问
亲,别照搬照抄,对症下药啊!!!
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询