Let's say I have buffer=Int[1,2,3,2,3] and token=[2,3].
Is there any preferred way of searching the occurrence of token in buffer to find [2,4] as the answer.
Or, perhaps, is there any split equivalent function for the integer arrays in julia?
(I know how I can perform this operation using 2 nested loops. However, I am especially interested if there is a more Julian way of doing this.)
For practice I have also made trial-and-errors and the following patterns have worked for Julia0.4.0. With
A = Int[1,2,3,2,3]andpat = Int[2,3], the first one isthe second one is
and the third one is
(where
find()returns the index array of true elements). But personally, I feel these patterns are more like python than julia way...