R/strip_fn.R

Defines functions strip_fn

Documented in strip_fn

#' Remove the file ext from fn
#' @param full_fn filename
#' @importFrom stringr str_remove
#' @export
strip_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.