R/str_detect_unbalanced.R

Defines functions str_detect_unbalanced str_remove_quotes

Documented in str_detect_unbalanced

#' Detect unbalanced (quotes)
#'
#' Detects whether strings contain unbalanced quites
#'
#' @param string character; string
#' @param quotes character; characters used for quiting
#'
#' @details
#'
#' Determines whether there are unb
#' Unbalanced quotes are determined by an odd number of quotes once all escaped
#' quotes are removed.
#'
#' @return logical
#'
#' @references
#'    Stackoverflow
#'
#' @examples
#
#   '      # TRUE
#   ''     # FALSE
#   '''    # TRUE
#   '\''   # FALSE
#   '\'\'  # TRUE
#
#'   str_detect_unbalanced( character(0) ) # locical(0)
#'   str_detect_unbalanced( "" )           # FALSE
#'   str_detect_unbalanced( "'" )          # TRUE
#'
#'   "foo \\' bar" %>% cat

str_detect_unbalanced <- function(string, quotes = c('\'', '"') ) {
  warning("not implemented yet.")
}

# Remove quotes around elements in vector
str_remove_quotes <- function(string, quotes=c("'", "\"") ) {
  warning("not implemented yet.")
}
decisionpatterns/stringr.tools documentation built on Nov. 4, 2019, 10:24 a.m.