View source: R/norm_trailing_slash.R
norm_trailing_slash | R Documentation |
Remove, or remove and insert a single trailing forward or back slash
norm_trailing_slash( x, how = c("remove", "replace"), replace_with = c("forward", "back"), strip_leading = FALSE, view_res = FALSE )
x |
A character vector |
how |
What kind of normalization should be performed? One of |
replace_with |
If |
strip_leading |
Also strip the first leading slash, if present? Defaults to |
view_res |
Output the structure the first six rows of the input and output? Defaults to |
Normalization is defined as taking the input and stripping a single trailing slash, if one is present. This is performed whether removing only, or replacing; hence, this function will remove a single trailing slash and stop, or also append a single trailing slash (and if so, the type of slash as specified by replace_with).There is nothing fancy about this function; it is a useful helper for e.g. creating directory strings
A character vector of length x
If view_res = TRUE
, the first six rows of the input and output are printed to the console via dput()
(with default args). This may be useful to verify that the literal output, sans escapes, are as expected by e.g.
calling View()
on the deparsed output.
norm_trailing_slash(x = c("/dir1\\", "/dir1/"), how = "remove", view_res = TRUE) norm_trailing_slash(x = c("/dir1\\", "/dir1/"), how = "replace", replace_with = "forward", view_res = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.