DeleteChars

public static string DeleteChars(this string input, params char[] chars) {
 return new string(input.Where((ch) => !chars.Contains(ch) ).ToArray());
}
Example:
string Text = "#Hello world.  This is a [test]";
string cleanText1 = Text.DeleteChars('#', '[', ']');  //return Hello world.  This is a test 
string cleanText2 = Text.DeleteChars('#');
//return Hello world.  This is a [test] 

Description

Remove from the given string, all characters provided in a params array of chars.

Details

Double click on the code to select all.

 

;