andrew4582

ReplaceInvalidChars

Jun 1st, 2011
295
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. //Replaces the invalid file name chars with "@" char.
  2.         public static void ReplaceInvalidChars(ref string fileName) {
  3.             char[] invalidChars = System.IO.Path.GetInvalidFileNameChars();
  4.  
  5.             for(int index = 0;index < invalidChars.Length;index++) {
  6.                 fileName = fileName.Replace(invalidChars[index],'@');
  7.             }
  8.         }
Advertisement
Add Comment
Please, Sign In to add comment