trimws                package:memisc                R Documentation

_T_r_i_m _L_e_a_d_i_n_g _a_n_d _T_r_a_i_l_i_n_g _W_h_i_t_e_s_p_a_c_e_s

_D_e_s_c_r_i_p_t_i_o_n:

     'trimws' returns a character string with leading and/or trailing
     whitespaces removed. This is just a shorthand for an appropriate
     call to sub.

_U_s_a_g_e:

       trimws(x,left=TRUE,right=TRUE)

_A_r_g_u_m_e_n_t_s:

       x: a character vector

    left: logical, if 'TRUE' leading whitespace is removed

   right: logical, if 'TRUE' trailing whitespace is removed

_V_a_l_u_e:

     The character vector 'x' with whitespace removed.

_E_x_a_m_p_l_e_s:

       teststr <- c(" Hello World!   ","I am here.  ")
       trimws(teststr)
       trimws(teststr,left=FALSE)
       trimws(teststr,right=FALSE)

