I like to use regular expressions. In this case you could do:
string replacement = Regex.Replace(s, @"\t|\n|\r", "");
Regular expressions aren’t as popular in the .NET world as they are in the dynamic languages, but they provide a lot of power to manipulate strings.
More Related Contents:
- Can you call Directory.GetFiles() with multiple filters?
- Easiest way to read from and write to files
- How to check for file lock? [duplicate]
- What is the ‘dynamic’ type in C# 4.0 used for?
- execute c# code at runtime from code file
- C# List Sort by x then y
- Converting Bitmap PixelFormats in C#
- How do I fix a .NET windows application crashing at startup with Exception code: 0xE0434352?
- Clipboard.GetText returns null (empty string)
- Why Func instead of Predicate?
- Wrapping StopWatch timing with a delegate or lambda?
- What is the correct way to read from NetworkStream in .NET
- A dictionary object that uses ranges of values for keys
- WCF Service Client: The content type text/html; charset=utf-8 of the response message does not match the content type of the binding
- A reproducible example of volatile usage
- The State of Linkers for .NET apps (aka “Please Sir, May I have a Linker” 2009 edition)
- How to Combine two lambdas [duplicate]
- thread with multiple parameters
- How to inject an attribute using a PostSharp attribute?
- WebClient runs javascript
- Why can I use a collection initializer with private set access from another class?
- Lock (Monitor) internal implementation in .NET
- How to specify data attributes in razor, e.g., data-externalid=”23151″ on @this.Html.CheckBoxFor(…)
- System.Threading.Timer in C# it seems to be not working. It runs very fast every 3 second
- Method to determine if path string is local or remote machine
- How do I mock User.Identity.GetUserId()?
- Azure Blob Storage | AcquireLeaseAsync, synchronously wait until lock is released
- Creating an empty file in C#
- What is the use case for the (C# 7.2) “private protected” modifier?
- Method Overloading with different return type [duplicate]