splitByPattern            package:R.utils            R Documentation

_S_p_l_i_t_s _a _s_i_n_g_l_e _c_h_a_r_a_c_t_e_r _s_t_r_i_n_g _b_y _p_a_t_t_e_r_n

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

     Splits a single character string by pattern.  The main difference
     compared to 'strsplit'() is that this method also returns the part
     of the string that matched the pattern. Also, it only takes a
     single character string.

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

     ## Default S3 method:
     splitByPattern(str, pattern, ...)

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

     str: A single 'character' string to be split.

 pattern: A regular expression 'character' string.

     ...: Not used.

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

     Returns a named 'character' 'vector' with names equal to '"TRUE"'
     if element is a pattern part and '"FALSE"' otherwise.

_A_u_t_h_o_r(_s):

     Henrik Bengtsson (<URL: http://www.braju.com/R/>)

_S_e_e _A_l_s_o:

     Compare to 'strsplit'().

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

     rspCode <- "<body>Hello <%=\"world\"%></body>"
     rspParts <- splitByPattern(rspCode, pattern="<%.*%>")
     cat(rspCode, "\n")
     print(rspParts)

