cpos                package:cwhstring                R Documentation

_F_i_n_d _t_h_e _p_o_s_i_t_i_o_n _o_f _a _s_u_b_s_t_r_i_n_g

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

     'cpos' finds the first position of a substring
     'substring.location' returns a list with starting and ending
     positions, works only with a single string.

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

     cpos(str,sub,start=1)
     substring.location(str, sub, restrict)

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

     str: string (1-dim)

     sub: string (1-dim)

   start: integer

restrict: vector of lower and upper index the search should be
          restricted to

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

     number, if found, NA otherwise. list(first,last)

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

     Christian W. Hoffmann, christian.hoffmann@wsl.ch, <URL:
     http://www.wsl.ch/staff/christian.hoffmann>

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

     cpos(" Baldrian","a",5) #  8
     cpos("Baldrian","B",15) # NA
     substring.location("In,theese,housees,there,are,rats","ees")
     #$first  [1]  6 15
     #$last   [1]  8 17

