In the majority of real life scenarios I'd likely just use a more simple
solution, such as the solution @robcole presented earlier, but this is
over 4x faster and uses a Lexer pattern to seek through the string, so
it is interesting and could be a better pattern to use in real life, but
practical scenarios (seeking through strings at a framework level, for
instance)
Definitely an interesting solution, and while the solution doesn't look
the most elegant, this pattern would look a lot more coarse in other
languages and that makes the outcome interesting to me!
In the majority of real life scenarios I'd likely just use a more simple solution, such as the solution @robcole presented earlier, but this is over 4x faster and uses a Lexer pattern to seek through the string, so it is interesting and could be a better pattern to use in real life, but practical scenarios (seeking through strings at a framework level, for instance)
Definitely an interesting solution, and while the solution doesn't look the most elegant, this pattern would look a lot more coarse in other languages and that makes the outcome interesting to me!