Loupe - Log - Monitor - Resolve
Gibraltar Namespace / FileSystemTools Class / SanitizeFileName Method
The file name to sanitize
When true, treat whitespace as an illegal value
When true, ensure the final name is lower case.
The character to substitute for illegal values, must be legal.

In This Topic
    SanitizeFileName Method
    In This Topic
    Sanitize the provided file name (without path) by substituting the specified character for illegal values.
    Syntax
    'Declaration
     
    
    Public Shared Function SanitizeFileName( _
       ByVal fileName As String, _
       Optional ByVal eliminateSpaces As Boolean, _
       Optional ByVal lowerCaseOnly As Boolean, _
       Optional ByVal replaceChar As Char _
    ) As String

    Parameters

    fileName
    The file name to sanitize
    eliminateSpaces
    When true, treat whitespace as an illegal value
    lowerCaseOnly
    When true, ensure the final name is lower case.
    replaceChar
    The character to substitute for illegal values, must be legal.

    Return Value

    The sanitized file name.
    Requirements

    Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

    See Also