R/replace_slash.R

Defines functions rs_replace_slash_fw2b rs_replace_slash_b2fw rs_replace_slash_bd2s rs_replace_slash_bs2d

Documented in rs_replace_slash_b2fw rs_replace_slash_bd2s rs_replace_slash_bs2d rs_replace_slash_fw2b

# 'Replace selected symbols' addins ---------------------------------------
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' Replace slash
#'
#' RStudio add-in to manage various types of slashes.
#' Select a piece of text with a cursor and do the necessary replacement
#' operation in the selected text: \itemize{
#'    \item `rs_replace_slash_bs2d` single back-slash into double back-slash;
#'    \item `rs_replace_slash_bd2s` double back-slash into single back-slash;
#'    \item `rs_replace_slash_b2fw` back-slash into forward-slash;
#'    \item `rs_replace_slash_fw2b` forward-slash into back-slash.
#' }
#'
#' @name replace_slash
#' @export
#' @family 'Replace selected symbols' add-ins
rs_replace_slash_bs2d <- function() {
    rs_replace_in_selection(pattern = "\\", replacement = "\\\\")
}

#' @rdname replace_slash
#' @export
rs_replace_slash_bd2s <- function() {
    rs_replace_in_selection(pattern = "\\\\", replacement = "\\")
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' @rdname replace_slash
#' @export
rs_replace_slash_b2fw <- function() {
    rs_replace_in_selection(pattern = "\\", replacement = "/")
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#' @rdname replace_slash
#' @export
rs_replace_slash_fw2b <- function() {
    rs_replace_in_selection(pattern = "/", replacement = "\\")
}
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GegznaV/addins.rs documentation built on May 5, 2023, 11:12 p.m.