Excel VBA之类的运算符

拉梅什

我正在使用excel VBA在另一个字符串中搜索子字符串,如下所示。

Dim pos As Integer
pos = InStr("I am studying at University of Texas at Arlington", "University of Texas")

如果pos返回非负值,则表示我在字符串中有子字符串。但是,我需要一个更复杂的搜索,其中子字符串可以是“ Tex大学”

InStr("I am studying at University of Texas at Arlington", "Univ of Tex")

对此不起作用。

基于最大搜索词,我需要说该子字符串存在。是否可以使用Excel VBA?

安迪·G

Like操作员已在VBA中提供:

If "I am studying at University of Texas at Arlington" Like "*Univ*of*Texas*" Then
    MsgBox "Yes, it is!"
End If

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章