Answers for "how to remove certain characters in a file name"

C#
1

removing illlegal char from filename

public string RemoveInvalidChars(string filename)
{
    return string.Concat(filename.Split(Path.GetInvalidFileNameChars()));
}
public string ReplaceInvalidChars(string filename)
{
    return string.Join("_", filename.Split(Path.GetInvalidFileNameChars()));    
}
Posted by: Guest on January-14-2021

Code answers related to "how to remove certain characters in a file name"

C# Answers by Framework

Browse Popular Code Answers by Language