c# - Compare two strings by ignoring certain characters -


I wonder if it's an easy way to see that two strings match in strings except for some characters. See examples below.

I can easily type such a method by searching for "wild card" characters by writing a regular expression and substituting them with a normal character. Then compare two strings str1 and str2. I am not looking for such implementation, but would like to know if there are any Net framework classes that can take care of this. Looks like a normal requirement, but I can not find any such method.

For example:

  string str1 = "ABC-EFG"; String Str 2 = "ABC * EFG";  

Two strings must be declared equal.

Thank you! Sorry, but I think that either regex, or "wildcard" characters, is a normal character. Your best solution to move with will be, in fact, you did not want to receive the answers given by you.


Comments