I’m having trouble figuring out how to split a string into groups of like characters. I have a few strings of rather random character groups similar to this one:
aaabb2222eee77777
I would like to be able to split them like so:
aaa, bb, 2222, eee, 77777
and then be able to count the number of characters in each set. What would be the easiest way to do this? I’m really not sure where to start. Thank you!
You can then iterate through the array and get the
strlen()of each item: