extension

The extension of the path including the leading dot.

extension
(
PathType
)
(
auto ref in PathType p
)
if (
isSomePath!PathType
)

Examples

The extension of "hello.foo.bar.exe" is ".exe".

assertEmpty(Path().extension);
assertEmpty(Path("").extension);
assertEmpty(Path("/").extension);
assertEmpty(Path("/hello").extension);
assertEmpty(Path("C:/hello/world").extension);
assertEqual(Path("C:/hello/world.exe").extension, ".exe");
assertEqual(Path("hello/world.foo.bar.exe").extension, ".exe");

Meta