stripExtension

Remove extension from path.

  1. auto stripExtension(R path)
  2. auto stripExtension(C[] path)
    stripExtension
    (
    C
    )
    (
    C[] path
    )

Parameters

path C[]

string or range to be sliced

Return Value

Type: auto

slice of path with the extension (if any) stripped off

Examples

assert(stripExtension("file")           == "file");
assert(stripExtension("file.ext")       == "file");
assert(stripExtension("file.ext1.ext2") == "file.ext1");
assert(stripExtension("file.")          == "file");
assert(stripExtension(".file")          == ".file");
assert(stripExtension(".file.ext")      == ".file");
assert(stripExtension("dir/file.ext")   == "dir/file");

Meta