I have a URL formatter in my application but the problem is that the customer wants to be able to enter special characters like:
: | / – “ ‘ & * # @
I have a string:
string myCrazyString = ":|/-\“‘&*#@";
I have a function where another string is being passed:
public void CleanMyString(string myStr)
{
}
How can I compare the string being passed “myStr” to “myCrazyString” and if “myStr has any of the characters in myCrazyString to remove it?
So if I pass to my function:
“this ‘ is a” cra@zy: me|ssage/ an-d I& want#to clea*n it”
It should return:
“this is a crazy message and I want to clean it”
How can I do this in my CleanMyString function?
Use Regular Expression for that Like:
||itself use\, so\|this will handle the|as normal character.Test: