Created
May 4, 2012 10:36
Remove invalid filename chars from string
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
string thestring = "test@/2"; | |
foreach(var character in Path.GetInvalidFileNameChars()) | |
{ | |
thestring = thestring.Replace(character.ToString(), ""); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any improvements to this would be welcome :D