Given the following two character vectors
stringA = c("AA", "BB", "CC", "BB", "DD", "CC")
stringB = c("BB", "CC")
I want to find the positions of stringB
within stringA
.
The result should be a vector of length stringB
, hence for this example: c(2, 3)
.
A vector of length one only containing the start position of the sequence (here: 2) would also be ok (since I know the length of stringB
and could operate further with it).
It can be assumed that the sequence of stringB
is unique within stringA
.