我正在使用 Excel VBA 搜索另一个字符串中的子字符串,如下所示。
Dim pos As Integer
pos = InStr("I am studying at University of Texas at Arlington", "University of Texas")
If pos
返回一个非负值,这意味着我在字符串中有子字符串。
然而,我需要更复杂的搜索,其中子字符串可以是“Univ of Tex”:
InStr("I am studying at University of Texas at Arlington", "Univ of Tex")
对此不起作用。
根据最大搜索词,我需要说子字符串存在。可以用excel VBA吗?
The Like
VBA 中已经提供了运算符:
If "I am studying at University of Texas at Arlington" Like "*Univ*of*Texas*" Then
MsgBox "Yes, it is!"
End If
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)