vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Function GenericPath.Segment.extension

The extension part of the file name.

auto extension() const nothrow @nogc @property;

If the file name contains an extension, this returns a forward range with the extension including the leading dot. Otherwise an empty range is returned.

See also

stripExtension

Example

assert(PosixPath("/foo/bar.txt").head.extension.equal(".txt"));
assert(PosixPath("/foo/bar").head.extension.equal(""));
assert(PosixPath("/foo/.bar").head.extension.equal(""));
assert(PosixPath("/foo/.bar.txt").head.extension.equal(".txt"));

Authors

Sönke Ludwig

Copyright

© 2012-2021 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.