public static class ExtensionMethods
{
public static string Replace(this string s, char[] separators, string newVal)
{
string[] temp;
temp = s.Split(separators, StringSplitOptions.RemoveEmptyEntries);
return String.Join( newVal, temp );
}
}
// use
char[] separators = new char[]{' ',';',',','
',' ','
'};
string s = "this;is,
a
test";
s = s.Replace(separators, "
");