This is reminiscent of Martin Gardner’s puzzles in Scientific American all those years ago.
I have a comma-delimited array of cattle ear tags, each of which may or may not have a leading alpha and always has a trailing numeric of undefined length, for example:
A typical array has many more elements than this so I want to simplify the list by grouping consecutive values (defined as consecutive numerics, all with the same leading alpha characters). When grouped, the above list would look like this:
I have struggled with implementing this grouping via array manipulation and resorted to using a separate database with a tag in each record. That’s a very messy way to do it and I’d really like somebody to come up with an elegant array-based solution.