Split an array into multiple arrays by value

Your values are starting in rs which is of type []string. []string means a slice (sequence) of strings. If I understand your question correctly, you don’t want all of the results back in a single sequence of strings at the end; you probably are looking for a sequence of sequences of strings, the first “subsequence” containing the first batch of values, then the second “subsequence” containing the second, etc.

Just as the type for a slice of strings is [] + string, the type for a slice of slices of strings is [] + []string = [][]string, so I believe arr should be of type [][]string so that you know where the subsequences start and end.

The next step I would take is to think of how to describe the steps in “pseudocode,” or code in some imaginary language that you should be able to “translate” into real code after you work out the steps. I would start off with pseudocode like this:

For each element, r, in rs:
  - If r starts with "101":
      - Create a new []string slice that we're going to put the elements into
      - For each element, r2, after r in rs:
          - If r starts with "101":
              - Break out of this inner loop because the 101 means we're starting
                a new sequence.
          - Else r does not start with 101, so append r2 to the sequence we
            created on pseudocode line 3
      - Append our []string slice to the slice-of-slices, arr.
  - Else we're at the first element in rs but it doesn't start with "101"
    What should we do now?

With the steps written out, I think it can more easily be translated into Go. I will say that it could be easier than how I wrote it out, but I think that it’s a start.