Reputation: 10156
I noticed that GetInvalidFileNameChars()
method is missing in Silverlight
. What is the best way to validate file names in this case?
Upvotes: 1
Views: 366
Reputation: 222582
Make use of regex,
string pattern = "[\\~#%&*{}/:<>?|\"-]";
string replacement = " ";
Regex regEx = new Regex(pattern);
string final = Regex.Replace(regEx.Replace(input, replacement), @"\s+", " ");
Upvotes: 2