R/utils-camel-case.R

Defines functions .lower_camel_case to_lower_camel

#' Convert a character vector to lower camel case
#' @param x a character vector
#' @keywords internal
#' @noRd
to_lower_camel <- function(x, call = rlang::caller_env()) {
  check_character(x, call = call, allow_null = TRUE)
  if (is.null(x)) {
    return(NULL)
  }
  vapply(strsplit(x, "_"), .lower_camel_case, character(1))
}

.lower_camel_case <- function(.x) {
  n <- length(.x)
  if (n == 1) {
    return(.x)
  }

  .x[2:n] <- tools::toTitleCase(.x[2:n])
  paste(.x, collapse = "")
}

Try the arcgisgeocode package in your browser

Any scripts or data that you put into this service are public.

arcgisgeocode documentation built on April 11, 2025, 6:12 p.m.