1、找一份词库
成都创新互联公司长期为数千家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为梅县企业提供专业的网站设计制作、成都做网站,梅县网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。
2、在“文中”进行分词、匹配
.net和java都有比较成熟的分词和词库,vb实现比较费时
Dim number As Long
Private Function FindStr(ByVal SLeft As Long, ByVal SFind As String, ByVal SSFind As String)
If Len(SFind) Len(SSFind) - SLeft Then
FindStr = -1
Exit Function
Else
FindStr = InStr(SLeft + 1, SSFind, SFind) - 1
End If
End Function
Private Sub Command1_Click()
number = FindStr(0, Text1.Text, RichTextBox1.Text)
If number = -1 Then
MsgBox "没有找到"
Command2.Enabled = False
Else
RichTextBox1.SelStart = number
RichTextBox1.SelLength = Len(Text1.Text)
Command2.Enabled = True
End If
End Sub
Private Sub Command2_Click()
number = FindStr(number + Len(Text1.Text), Text1.Text, RichTextBox1.Text)
If number = -1 Then
MsgBox "查找完毕"
Command2.Enabled = False
Else
RichTextBox1.SelStart = number
RichTextBox1.SelLength = Len(Text1.Text)
Command2.Enabled = True
End If
End Sub
注意RichTextBox1.HideSelection要设为false
遍历datagridview的单元格,判断单元格内的值是否与textbox的text相等。
foreach (DataGridViewRow row in dataGridView1.Rows)
{
foreach(DataGridViewCell cell in row)
{
if(cell.value = textbox1.text) then
cell.focus()
else
msg("没有找到相关信息")
}
}
dim str1 ,str2 as string
dim n as integer
str2=inputbox("请输入要查找的字符:")
for n=1 to len(textbox1.text)
str1=mid(textbox1.text,n,1)
if str2=str1 then
msgbox("找到啦!")
exit for
end if
next
if n=len(textbox1.text)+1 then
msgbox("没有你要找的字符!")
end if
网页名称:vb.net查找错字 vb查找字符串位置
当前地址:https://www.cdcxhl.com/article28/dddgpcp.html
成都网站建设公司_创新互联,为您提供网站策划、软件开发、、网站制作、商城网站、网站维护
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联