sanitize For File
Sanitizes an arbitrary string so that it is safe to use as part of a filename or path segment.
Transformations:
Replaces characters invalid on common filesystems (
\ / : * ? " < > |
) with-
.Collapses runs of whitespace into a single
-
.Collapses runs of
-
into a single-
.Trims leading and trailing
-
.
Return
A filesystem-friendly token.
Parameters
part
Arbitrary input text to sanitize.