name

The name of the path without any of its parents.

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

Examples

1 assertEqual(WindowsPath().name, ".");
2 assertEqual(WindowsPath("").name, ".");
3 assertEmpty(WindowsPath("/").name);
4 assertEqual(WindowsPath("/hello").name, "hello");
5 assertEqual(WindowsPath("C:\\hello").name, "hello");
6 assertEqual(WindowsPath("C:/hello/world.exe").name, "world.exe");
7 assertEqual(WindowsPath("hello/world.foo.bar.exe").name, "world.foo.bar.exe");
8 
9 assertEqual(PosixPath().name, ".");
10 assertEqual(PosixPath("").name, ".");
11 assertEmpty(PosixPath("/").name, "/");
12 assertEqual(PosixPath("/hello").name, "hello");
13 assertEqual(PosixPath("C:\\hello").name, "C:\\hello");
14 assertEqual(PosixPath("/foo/bar\\ baz.txt").name, "bar\\ baz.txt");
15 assertEqual(PosixPath("C:/hello/world.exe").name, "world.exe");
16 assertEqual(PosixPath("hello/world.foo.bar.exe").name, "world.foo.bar.exe");

Meta