vb 文本提取
例如假定text1.text中有如下文本dsfsfdsfkk545454wecccdsfsfdsfkk45454wecccyydsfsfdsfkk54bb4weccchh...
例如假定text1.text中有如下文本
dsfsfdsfkk545454weccc
dsfsfdsfkk45454wecccyy
dsfsfdsfkk54bb4weccchh
dsfsfdsfkk5455554wecccvv
我要提取各行 kk 和 ccc 之间的数值,然后把提取的值放到text2.text中
该如何编程? 展开
dsfsfdsfkk545454weccc
dsfsfdsfkk45454wecccyy
dsfsfdsfkk54bb4weccchh
dsfsfdsfkk5455554wecccvv
我要提取各行 kk 和 ccc 之间的数值,然后把提取的值放到text2.text中
该如何编程? 展开
2个回答
展开全部
Private Sub Command1_Click()
On Error Resume Next
Dim mStr, Rsult$, i%
mStr = Split(Text1.Text, Chr(10))
For i = 0 To UBound(mStr)
Rsult = Rsult & Mid(mStr(i), InStr(mStr(i), "kk") + 2, InStr(mStr(i), "ccc") - InStr(mStr(i), "kk") - 2) & vbCrLf
Next i
Text2.Text = Rsult
End Sub
On Error Resume Next
Dim mStr, Rsult$, i%
mStr = Split(Text1.Text, Chr(10))
For i = 0 To UBound(mStr)
Rsult = Rsult & Mid(mStr(i), InStr(mStr(i), "kk") + 2, InStr(mStr(i), "ccc") - InStr(mStr(i), "kk") - 2) & vbCrLf
Next i
Text2.Text = Rsult
End Sub
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询