I like to use:
myString = Regex.Replace(myString, @"\s+", " ");
Since it will catch runs of any kind of whitespace (e.g. tabs, newlines, etc.) and replace them with a single space.
More Related Contents:
- How do I get two numbers between two words (C#) [closed]
- How to cut up a string from an input file with Regex or String Split, C#?
- C# regex replace of numbers and units
- Find and extract a number from a string
- Get string between two strings in a string
- How do I replace the *first instance* of a string in .NET?
- How can I strip HTML tags from a string in ASP.NET?
- Add spaces before Capital Letters
- Detecting *all* emojis
- Matching strings with wildcard
- Remove HTML tags from string including   in C#
- Remove text in-between delimiters in a string (using a regex?)
- Need to perform Wildcard (*,?, etc) search on a string using Regex
- Regex : how to get words from a string (C#)
- Regex nested parentheses
- How to remove empty lines from a formatted string
- How to extract decimal number from string in C#
- Regular expression to find and remove duplicate words
- Get values between curly braces c#
- Replace non-numeric with empty string
- Parsing formatted string
- Splitting a string in C#
- How to read an entire file to a string using C#?
- What does {0} mean when found in a string in C#?
- How can I format a number into a string with leading zeros?
- Display Float as String with at Least 1 Decimal Place
- Delete last char of string
- Why is \ character being doubled in my @ string?
- string.Join on a List or other type
- How to sort list of Ip Addresses using c#