I want to merge multiple spaces into single space(space could be tab also) and remove trailing/leading spaces.
For example...
string <- "Hi buddy what's up Bro"
to
"Hi buddy what's up bro"
I checked the solution given at Regex to replace multiple spaces with a single space. Note that don't put or
as exact space inside the toy string and feed that as pattern in gsub
. I want that in R.
Note that I am unable to put multiple space in toy string. Thanks
See Question&Answers more detail:os