Skip to content
Prev 79611 / 398502 Next

Can anyone please tell me how to strip the white spaces from a character vector?

roger bos wrote:

            
Not beeing an expert for regular expressions, I'd try
    sub(" *$", "", sub("^ *", "", a$tic))
to strip from beginnings and ends but there may be far better approches.
In order to remove *all* blanks, try
    gsub(" ", "", a$tic)

Uwe Ligges