Documentation

Path

Namespace

String operations for file paths.

Gets the file extension for the given path, including the period. If there is no file extension, this returns an empty string. For example, hello.txt will return .txt.

Returns string

Returns true if the given path has a file extension.

Returns bool

Changes the file extension in the given path and returns the new path. If the original path has no file extension, this will add the given file extension.

Returns string

Removes the file extension from the given path. If there is no file extension, this returns the original path. For example, hello.txt will return hello.

Returns string

Combines two paths into one. This automatically glues the paths with forward slashes where needed. For example, passing hello and world will return hello/world, but so will passing hello/ and world. You should not combine multiple absolute paths using this function.

Returns string

Returns true if the given 2 paths can be considered equal.

Returns bool

Returns the path to the directory of the containing path, including the path separator, excluding the filename. For example, hello/world/foo.txt will return hello/world/.

Returns string

Gets the file name and extension of the given path. For example, hello/world/foo.txt will return foo.txt.

Returns string

Gets the file name of the given path without the extension. For example, hello/world/foo.txt will return foo.

Returns string

Sanitizes the given filename and replaces invalid characters with underscores. You may use this for both file names and folder names.

Returns string