I wonder if there is an easy way to check if two strings match by excluding certain characters in the strings. See example below.
I can easily write such a method by writing a regular expression to find the ‘wild card’ characters, and replace them with a common character. Then compare the two strings str1 and str2. I am not looking for such implementations, but like to know whether there are any .Net framework classes that can take care of this. Seems like a common need, but I couldn’t find any such method.
For example:
string str1 = 'ABC-EFG'; string str2 = 'ABC*EFG';
The two strings must be declared equal.
Thanks!
Sorry but I think either regex, or replacing the ‘wildcard’ characters with a common character are going to be your best solution. Basically, the answers that you stated you didn’t want to receive.