I have a string in the following format
string s = \"This is a Test String.\\n This is a next line.\\t This is a tab.\\n\'
I want to remo
The right choice really depends on how big the input string is and what the perforce and memory requirement are, but I would use a regular expression like
string result = Regex.Replace(s, @"\r\n?|\n|\t", String.Empty);
Or if we need to apply the same replacement multiple times, it is better to use a compiled version for the Regex like
var regex = new Regex(@"\r\n?|\n|\t", RegexOptions.Compiled);
string result = regex.Replace(s, String.Empty);
NOTE: different scenarios requite different approaches to achieve the best performance and the minimum memory consumption