Skip to content

Instantly share code, notes, and snippets.

@csharpforevermore
Created November 11, 2013 18:21
Show Gist options
  • Save csharpforevermore/7417789 to your computer and use it in GitHub Desktop.
Save csharpforevermore/7417789 to your computer and use it in GitHub Desktop.
Replace unprintable characters in a string
private string GetRidOfUnprintablesAndUnicode(string inpString)
{
return inpString.Where(ch => ((int) (byte) ch) >= 32 & ((int) (byte) ch) <= 128).Aggregate(String.Empty, (current, ch) => current + ch);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment