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

philcruz picture philcruz · Sep 23, 2008 · Viewed 212.3k times · Source

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

Answer

philcruz picture philcruz · Sep 23, 2008
string s = "søme string";
s = Regex.Replace(s, @"[^\u0000-\u007F]+", string.Empty);