自编找茬

shallendor 2006-11-23 07:48:52
先看一段程序:
dim condition as string
condition=Text1.text
if condition="Hello"then
msgbox"Yes"
endif
显然,只输入Hello的前三个字母,程序不会执行then后面的语句.这说明程序只允许精确匹配,不允许部分匹配.谁能编写出部分匹配的例子程序来?
...全文
158 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
tinsang 2006-11-25
  • 打赏
  • 举报
回复
同意 colorslife(下气不接上气) 的方法
dai_huzi9527 2006-11-24
  • 打赏
  • 举报
回复
怎么编译那个单引号的时候提示"缺少表达式"嘛?
colorslife 2006-11-24
  • 打赏
  • 举报
回复
Private Sub Command1_Click()
Dim condition As String
condition = Text1.Text

If "Hello" Like "*" & condition & "*" Then

MsgBox "Yes"
End If

End Sub
wxf2008 2006-11-24
  • 打赏
  • 举报
回复
instr
jsluchao 2006-11-23
  • 打赏
  • 举报
回复
使用部分匹配
dim condition as string
condition=Text1.text
if condition like '%" hello "%'then
msgbox"Yes"
endif
LyndonZheng 2006-11-23
  • 打赏
  • 举报
回复
关注
clear_zero 2006-11-23
  • 打赏
  • 举报
回复
instr这个函数是部分匹配的,如果返回=0就是没有,否则就是由

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧