Thursday, October 9, 2008
Search string with Wild Card
Public Function CheckWildCardString(ByVal String1 As String, ByVal String2 As String) As BooleanDim I As Long If Left$(String1, 1) = Chr$(42) And Right$(String1, 1) = Chr$(42) ThenString1 = Replace$(String1, Chr(42), Empty) For I = 1 To Len(String2) If LCase$(Mid(String2, I, Len(String1))) = LCase$(String1) ThenCheckWildCard = TrueExit FunctionEnd IfNext IElseIf Left$(String1, 1) = Chr$(42) Then If LCase$(Right(String2, Len(String1))) = LCase$(String1) ThenCheckWildCard = TrueExit FunctionEnd IfElseIf Right$(String1, 1) = Chr$(42) ThenString1 = Replace$(String1, Chr$(42), Empty)If LCase$(Left(String2, Len(String1))) = LCase$(String1) ThenCheckWildCard = TrueExit FunctionEnd IfElseCheckWildCard = FalseExit FunctionEnd IfEnd Function
Share This!
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment