比如在“张三家里有条狗名字叫小花”字符串中判断是否有“名字”存在?
Sub test1()
Dim str As String
str = "张三家里有条狗名字叫小花"
If InStr(str, "名字") Then
MsgBox "包含"
Else
MsgBox "不包含"
End If
End Sub
Sub test2()
Dim str As String
str = "张三家里有条狗名字叫小花"
If str Like "*名字*" Then
MsgBox "包含"
Else
MsgBox "不包含"
End If
End Sub
