我有一个包含“Hot Soup”的数组。当我在If语句中使用以下函数来测试是否在数组中找到“Soup”时,它返回true:
Function FindInArray(StringToBeFound As Variant, ThisArray As Variant) As Boolean
FindInArray = (UBound(Filter(ThisArray, StringToBeFound)) > -1)
End Function
测试:
Sub Test()
Dim bool As Boolean
myArray = Array("Hot Soup", "Vanilla")
bool = FindInArray("Soup", myArray)
MsgBox bool
End Sub
返回true,但不是。如果匹配准确,是否有办法返回true?
谢谢!