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".

1 assertEmpty(Path().extension);
2 assertEmpty(Path("").extension);
3 assertEmpty(Path("/").extension);
4 assertEmpty(Path("/hello").extension);
5 assertEmpty(Path("C:/hello/world").extension);
6 assertEqual(Path("C:/hello/world.exe").extension, ".exe");
7 assertEqual(Path("hello/world.foo.bar.exe").extension, ".exe");

Meta