instring              package:clim.pact              R Documentation

_i_n_s_t_r_i_n_g

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

     Finds the position of a character in a string (character vector).
     Similar to regexpr(), but a test with regexpr() failed with some
     characters. instring() returns all position with a character
     match, whereas regexpr() only returns the first position for a
     pattern match.

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

     instring(c,target,case.match=TRUE)

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

       c: Character to look for.

  target: string to search.

case.match: FALSE -> not case sensitive.

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

     vector of intigers.

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

     R.E. Benestad

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

     instring("e","efile.dat")
     # 1 5
     regexpr("e","efile.dat")
     #[1] 1
     #attr(,"match.length")
     #[1] 1 
     # Case when regexpr() doesn't give the desired result:
     regexpr(".","file.name")
     #[1] 1
     #attr(,"match.length")
     #[1] 1
     instring(".","file.name")
     #[1] 5

