Click or drag to resize

FilePathGetValidFileName Method

Gets a valid file name by replacing invalid file name characters with replaceWithCharacter.

Namespace: GSF.IO
Assembly: GSF.Core (in GSF.Core.dll) Version: 2.4.253-beta+ffb7163c9e3b771705bc5b9aa3f09870f2cb9e2c
Syntax
public static string GetValidFileName(
	string fileName,
	char replaceWithCharacter = '_'
)
View Source

Parameters

fileName  String
File name to validate.
replaceWithCharacter  Char  (Optional)
Character to replace invalid file name characters with. Set to '\0' to remove invalid file name characters.

Return Value

String
A valid file name with no invalid file name characters.
Remarks
This function expects a file name, not a file name with a path. To properly get a valid file path, where all directory names and the file name are validated, use the GetValidFilePath(String, Char). Calling the GetValidFileName(String, Char) function will a full path will yield all directory separators replaced with the replaceWithCharacter.
See Also