Removing non ASCII characters in C#

Jan 18, 2010 Posted by Lara Kannan
Its one of the C# Tip....

Removing non ASCII characters in C# by using the regular expression.

To make sure you clean your string from non ASCII characters you can use Regex class instead of using string functions. The [\x01-\x1F] is the range you want to keep.

temp = Regex.Replace(temp, "[\x01-\x1F]", "");

Happy coding...

Thanks : http://alpascual.com/

Share

Post a Comment