% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/trim.R
\name{trim}
\alias{trim}
\title{trim leading and trailing blanks}
\usage{
trim(
  x,
  leading = FALSE,
  trailing = TRUE,
  middle = FALSE,
  all = FALSE,
  blank = " "
)
}
\arguments{
\item{x}{string vector or matrix}

\item{leading}{= 1 to remove the leading blanks}

\item{trailing}{= 1 to remove the trailing blanks}

\item{middle}{= 1 to replace consecutive blanks by one (compress)}

\item{all}{= 1 to remove the leading and trailing blanks and compress\cr
= 2 to remove all the blanks}

\item{blank}{= a character to define the blank}
}
\value{
trimed string vector
}
\description{
trim leading and trailing blanks
}
\examples{
testc="   c a  p r i    ci  ous   "
trim( testc )
trim( testc, leading=1, trailing=0 )
trim( testc, middle=1, trailing=0 )
trim( trim( testc, middle=1 ), leading=1 )
trim( testc , all=1 ) # same as above.
trim( testc, all=2 )
A=demomat(3,3,root="a"); A[1,1]="  a1 1"; A[2,2]="   a2 2 "
trim(A,all=1)
trim(A,all=2)

}
