Range with path's extension (if any) replaced with ext. The element encoding type of the returned range will be the same as path's.
import std.array; assert(withExtension("file", "ext").array == "file.ext"); assert(withExtension("file"w, ".ext"w).array == "file.ext"); assert(withExtension("file.ext"w, ".").array == "file."); import std.utf : byChar, byWchar; assert(withExtension("file".byChar, "ext").array == "file.ext"); assert(withExtension("file"w.byWchar, ".ext"w).array == "file.ext"w); assert(withExtension("file.ext"w.byWchar, ".").array == "file."w);
Replace existing extension on filespec with new one.