Skip to content

Instantly share code, notes, and snippets.

@jaddie
Created May 4, 2012 10:36
Show Gist options
  • Save jaddie/2594003 to your computer and use it in GitHub Desktop.
Save jaddie/2594003 to your computer and use it in GitHub Desktop.
Remove invalid filename chars from string
string thestring = "test@/2";
foreach(var character in Path.GetInvalidFileNameChars())
{
thestring = thestring.Replace(character.ToString(), "");
}
@jaddie
Copy link
Author

jaddie commented May 4, 2012

Any improvements to this would be welcome :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment