Skip to content

StringHelper.SanitizeFilePath method

Sanitizes the path by removing diacritics (ü with u, ı with i etc.) and replacing any invalid file path characters with underscore.

public static string SanitizeFilePath(string filename, string replacement = "_", 
    bool removeDiacritics = true)
parameter description
filename The string.
replacement Replacement string for invalid characters
removeDiacritics True to remove diacritics

Exceptions

exception condition
ArgumentNullException s is null

See Also