#338 - New `str_crush()` convenience wrapper function to remove all whitespace.

Open Joe Thorley joethorley

No flags found

Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.

e.g., #unittest #integration

#production #enterprise

#frontend #backend

Learn more about Codecov Flags here.

Showing 1 of 7 files from the diff.
Other files ignored by Codecov
NEWS.md has changed.
man/str_trim.Rd has changed.
_pkgdown.yml has changed.
NAMESPACE has changed.

@@ -1,7 +1,7 @@
Loading
1 1
#' Trim whitespace from a string
2 2
#'
3 3
#' `str_trim()` removes whitespace from start and end of string; `str_squish()`
4 -
#' also reduces repeated whitespace inside a string.
4 +
#' also reduces repeated whitespace inside a string; `str_crush()` removes all whitespace.
5 5
#'
6 6
#' @param string A character vector.
7 7
#' @param side Side on which to remove whitespace (left, right or both).
@@ -14,6 +14,9 @@
Loading
14 14
#'
15 15
#' str_squish("  String with trailing,  middle, and leading white space\t")
16 16
#' str_squish("\n\nString with excess,  trailing and leading white   space\n\n")
17 +
#'
18 +
#' str_crush("  String with trailing,  middle, and leading white space\t")
19 +
#' str_crush("\n\nString with excess,  trailing and leading white   space\n\n")
17 20
str_trim <- function(string, side = c("both", "left", "right")) {
18 21
  side <- match.arg(side)
19 22
@@ -29,3 +32,9 @@
Loading
29 32
str_squish <- function(string) {
30 33
  stri_trim_both(str_replace_all(string,"\\s+"," "))
31 34
}
35 +
36 +
#' @export
37 +
#' @rdname str_trim
38 +
str_crush <- function(string) {
39 +
  str_replace_all(string, "\\s", "")
40 +
}

Everything is accounted for!

No changes detected that need to be reviewed.
What changes does Codecov check for?
Lines, not adjusted in diff, that have changed coverage data.
Files that introduced coverage data that had none before.
Files that have missing coverage data that once were tracked.
Files Coverage
R 0.03% 88.19%
Project Totals (27 files) 88.19%
Loading