text文本里边查找字符串 我想在text文本里边查找我需要的字符串,想看看text文本中一共出现了多少个我需要查找的字符串。自动计算出来,请问这个怎么实现啊? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Text1.Text = "abcdefgbcdabcbop" Dim b As String: b = "ab" MsgBox Len(Replace(Text1.Text, b, String(Len(b) + 1, "*"))) - Len(Text1.Text) Private Sub Command1_Click() Dim i As Integer, n As Integer, w As Integer, iStr As String Text1 = "xxxabyyyyabcccabhhhabyyy" iStr = "ab" For i = 1 To Len(Text1) w = InStr(i, Text1, iStr) If w <> 0 Then n = n + 1 i = w + Len(iStr) Else Exit For End If Next MsgBox n End Sub Private Sub Command1_Click() Dim iStr1 As String Text1 = "xxxabyyyyabcccabhhhabyyy" iStr1 = "ab" MsgBox (Len(Text1) - Len(Replace(Text1, iStr1, ""))) / Len(iStr1) End Sub 用InputB函数将文件内容全部读入String变量,再用Instr函数循环查找并计数或用VBScript中的正则表达式 如果我想从txt文本文档里查找怎么弄啊,上午字符串太多了,text文本框放不下。如果我想从txt文档中查找怎不实现啊。 text文本框放不下*******************可以用richtextbox 有没有人帮帮忙 vb6.0获取网络文件大小 超无聊,玩. 散分!庆祝论坛开通至今流量超过10000!!! 如何用vb在托盘显示一个真彩色的图标或(者256色) VB2005有下载的吗? 好东西大家分享!!看看哦! 我想打开时和设计大小一样的b窗体,不知道怎么做? 请大家帮忙看看下面这几段代码的意思 用VB写程序制作版本的问题 MMControl 控件只能播放一次 VB怎么操作其他程序呢?
Dim b As String: b = "ab"
MsgBox Len(Replace(Text1.Text, b, String(Len(b) + 1, "*"))) - Len(Text1.Text)
Private Sub Command1_Click()
Dim i As Integer, n As Integer, w As Integer, iStr As String
Text1 = "xxxabyyyyabcccabhhhabyyy"
iStr = "ab"
For i = 1 To Len(Text1)
w = InStr(i, Text1, iStr)
If w <> 0 Then
n = n + 1
i = w + Len(iStr)
Else
Exit For
End If
Next
MsgBox n
End Sub
Private Sub Command1_Click()
Dim iStr1 As String
Text1 = "xxxabyyyyabcccabhhhabyyy"
iStr1 = "ab"
MsgBox (Len(Text1) - Len(Replace(Text1, iStr1, ""))) / Len(iStr1)
End Sub
或用VBScript中的正则表达式
*******************
可以用richtextbox