Advertisement
7_2009-2012 String Manipulation #226867

Wildcard Matcher

This code matches a given string against a pattern which may contain the well known wildcards * and ?, whereas * represents any number of characters, including none, and ? represents any single character. You may want to paste the code into a class module :)

AI

ملخص الذكاء الاصطناعي: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

كود المصدر
original-source
Public Function Match(Name As String, Pattern As String) As Boolean
  If MatchCase(LCase(Name), LCase(Pattern)) Then Match = True
End Function

Public Function MatchCase(Name As String, Pattern As String) As Boolean
  Pattern = PreparePattern(Pattern)
  If Name Like Pattern Then MatchCase = True
End Function
Private Function PreparePattern(Pattern As String) As String
  Pattern = Replace(Pattern, "[", "[[]")
  Pattern = Replace(Pattern, "#", "[#]")
  PreparePattern = Pattern
End Function
التعليقات الأصلية (3)
مسترجع من Wayback Machine