| cpos {cwhstring} | R Documentation |
cpos finds the first position of a substring
substring.location returns a list with starting and ending
positions, works only with a single string.
cpos(str,sub,start=1) substring.location(str, sub, restrict)
str |
string (1-dim) |
sub |
string (1-dim) |
start |
integer |
restrict |
vector of lower and upper index the search should be restricted to |
number, if found, NA otherwise. list(first,last)
Christian W. Hoffmann, christian.hoffmann@wsl.ch, http://www.wsl.ch/staff/christian.hoffmann
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