baseAndExtension: Gets the base and the extension of a filename

Description Usage Arguments Value Author(s) See Also Examples

Description

Gets the base and the extension of a filename, i.e. the character strings before and after the last period ('.') in the filename. If no base (extension) exists, it take the value "".

Note, here base means a different thing from what is meant in the function basename().

Usage

1
2
## Default S3 method:
baseAndExtension(filename, ...)

Arguments

filename

A filename.

...

Not used.

Value

Returns a vector of two character strings; the base and the extension.

Author(s)

Henrik Bengtsson

See Also

basename() (includes dirname()).

Examples

1
2
3
  baseAndExtension("/usr/local/bin/foo.sh")  # "/usr/local/bin/foo" "sh"
  baseAndExtension("/usr/local/bin/foo...")  # "/usr/local/bin/foo.." ""
  baseAndExtension("/usr/local/bin/")        # "/usr/local/bin/" ""

HenrikBengtsson/R.basic documentation built on May 6, 2019, 11:51 p.m.