R/countSpaces.R

#' countSpaces
#'
#' Count the number of spaces in a string
#' @param s string to count spaces
#' @return return the count of spaces
#' @export
countSpaces <- function(s) {
  sapply(gregexpr(" ", s), function(p) { sum(p>=0) } )
}
MikeMorris89/rmm documentation built on May 8, 2019, 10:49 a.m.