How can you strip non-ASCII characters from a string in C# ?

Regular expressions is one of the easiest way to strip non-ascii characters from a string in C#. Here’s how you do it.

How can you strip non-ASCII characters from a string in C# ?

string input = "søme";
input = Regex.Replace(input, @"[^\u0000-\u007F]+", string.Empty);