cleanSpaces function

Drop leading, trailing and repeated spaces in character strings

Drop leading, trailing and repeated spaces in character strings

cleanSpaces(x, double = TRUE, lead = TRUE, trail = TRUE)

Arguments

  • x: A vector of character strings to modify
  • double: Replace any number of consecutive blank spaces by a single blank. Default is TRUE.
  • lead: Drop spaces before first non-empty character. Default is TRUE.
  • trail: Drop spaces after last non-empty character. Default is TRUE.

Returns

A vector of class character

  • Maintainer: Philip Delff
  • License: MIT + file LICENSE
  • Last published: 2025-03-21