Duality.PathHelper.GetValidFileName C# (CSharp) Method

GetValidFileName() public static method

Takes a string that is supposed to be a file name and converts it into an actually valid file name, replacing invalid characters by undercores.
public static GetValidFileName ( string fileName ) : string
fileName string A string that is supposed to be a file name.
return string
        public static string GetValidFileName(string fileName)
        {
            string invalidChars = new string(Path.GetInvalidFileNameChars());
            string invalidReStr = string.Format(@"([{0}]*\.+$)|([{0}]+)", Regex.Escape(invalidChars));
            return Regex.Replace(fileName, invalidReStr, "_");
        }