Replace leading whitespace with a specified string
Source:R/post_process.R
replace_leading_whitespace.RdUseful for HTML rendering where leading spaces are collapsed.
Examples
# Indentation survives an HTML renderer that would collapse plain spaces
terms <- c("CARDIAC DISORDERS", " ATRIAL FIBRILLATION")
out <- replace_leading_whitespace(terms)
out
#> [1] "CARDIAC DISORDERS" " ATRIAL FIBRILLATION"
# One replacement per leading space; interior spacing is untouched
replace_leading_whitespace(" A B", replace_with = "-")
#> [1] "--A B"