Description
The WildcardMatch
method is a static extension method provided by the SandboxSystemExtensions
class. It is used to determine if a given string matches a specified wildcard pattern. This method is useful for pattern matching scenarios where wildcards are used to represent one or more characters.
Usage
To use the WildcardMatch
method, you need to pass two parameters:
str
: The string you want to test against the wildcard pattern.
wildcard
: The wildcard pattern that may contain special characters like *
(matches zero or more characters) and ?
(matches exactly one character).
The method returns a bool
indicating whether the string matches the wildcard pattern.
Example
// Example usage of WildcardMatch method
string input = "example.txt";
string pattern = "*.txt";
bool isMatch = SandboxSystemExtensions.WildcardMatch(input, pattern);
// isMatch will be true because "example.txt" matches the pattern "*.txt".