a RandomAccessRange that can be sliced.
a slice of path
assert (stripExt("file") == "file"); assert (stripExt("file.ext") == "file"); assert (stripExt("file.ext1.ext2") == "file.ext1"); assert (stripExt("file.") == "file"); assert (stripExt(".file") == ".file"); assert (stripExt(".file.ext") == ".file"); assert (stripExt("dir/file.ext") == "dir/file"); { import std.internal.scopebuffer; char[10] tmpbuf = void; auto buf = ScopeBuffer!char(tmpbuf); scope(exit) buf.free(); buf.length = 0; "file.ext".byChar().stripExt().copy(&buf); assert(buf[] == "file"); }
Returns slice of path[] with the extension stripped off.
stripExt is an algorithm that does not allocate nor throw, it is pure and @safe.