Returns the extension of the filename including the leading dot, as a string. If the filename has no extension, returns an empty string.
Note that if the filename starts with a dot (e.g. .gitignore),
that dot is considered part of the stem. So .gitignore has
extension '' and .gitignore.bak has extension .bak
Returns the stem of the filename, i.e. the part before the extension. If the filename has no extension, returns the entire filename
Note that if the filename starts with a dot (e.g. .gitignore),
that dot is considered part of the stem. So .gitignore and
.gitignore.bak both have stem .gitignore
Returns true if this filename equals the other filename or string.
Replace the filename extensions, keeping the stem the same
A new Filename instance
Replace the filename stem, keeping the extension the same
A new Filename instance
Returns the filename as a string.
StaticisReturns true if the provided string is a valid filename (i.e. does not contain any path separators)
Represents a filename, without any path components, an provides methods to query and manipulate it.
The class is immutable; all methods that modify the filename return a new instance.
The constructor ensures that the filename does not contain any directory separators. If it does, an error is thrown.
Example