C#快速剔除字符串中不合法的文件名
string strFileName= "文件名称";
StringBuilder rBuilder = new StringBuilder(strFileName);
foreach(char rInvalidChar in Path.GetInvalidFileNameChars())
rBuilder.Replace(rInvalidChar.ToString(), string.Empty); C#快速剔除字符串中不合法的文件路径字符
string rPath = "路径";
StringBuilder rBuilder = new StringBuilder(rPath);
foreach(char rInvalidChar in Path.GetInvalidPathChars())
rBuilder.Replace(rInvalidChar.ToString(), string.Empty);