R/utils.R

Defines functions .format_name_to_url

Documented in .format_name_to_url

#' @title Format name to url's pattern
#' @param name Name to format
#' @return Formated name
.format_name_to_url <- function(name) {
  name <- name %>%
    tolower() %>%
    str_replace_all("!", "exclamationmark") %>%
    str_replace_all("-", "hyphen") %>%
    str_replace_all("[:punct:]", "") %>%
    str_replace_all("exclamationmark", "!") %>%
    str_replace_all("hyphen", "-") %>%
    str_replace_all(" ", "-") %>%
    stri_trans_general("Latin-ASCII")
  return(name)
}
metalyrics/rmetacritic documentation built on Dec. 12, 2019, 5:32 a.m.