R/remove_file_ext_from_fn.R

Defines functions remove_file_ext_from_fn

Documented in remove_file_ext_from_fn

#' Remove the file ext from fn
#' @param full_fn filename
#' @importFrom stringr str_remove
#' @export
remove_file_ext_from_fn <-
        function(full_fn, rm_ext = TRUE, rm_path = TRUE) {
                x <- full_fn
                if (rm_ext == TRUE) {
                        x <- str_remove(full_fn, "[.]{1}[a-zA-Z]{1,6}$")
                }

                if (rm_path == TRUE) {
                        x <- basename(x)
                }

                return(x)
        }
patelm9/mirroR documentation built on Feb. 12, 2020, 2:41 p.m.