The OpenD Programming Language

stripExtension

Remove extension from path.

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

Parameters

path R

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