Description
The NormalizeFilename
method is a static extension method provided by the SandboxSystemExtensions
class. It is used to normalize a given filename string by ensuring it adheres to certain formatting rules. This method can enforce an initial slash at the beginning of the filename if specified.
Usage
To use the NormalizeFilename
method, you need to pass a string representing the filename you want to normalize and a boolean indicating whether to enforce an initial slash. The method will return a normalized version of the filename as a string.
Parameters:
str
: The filename string to be normalized.
enforceInitialSlash
: A boolean value indicating whether the normalized filename should start with a slash.
Example
// Example usage of NormalizeFilename
string filename = "example/path/to/file.txt";
bool enforceSlash = true;
string normalizedFilename = SandboxSystemExtensions.NormalizeFilename(filename, enforceSlash);
// normalizedFilename will be "/example/path/to/file.txt" if enforceSlash is true.