Substrings Through Ranges
Thomas Mailund · Apress eBooks · 2021
One thing that bothers me with the iterators in Chapter 7 is that when we searched for words or integers, we didn’t get the string we matched back. We got a pointer to the position where the match started. We would need to search again for the end of the match if we wanted to know how large the match was. To extract the words, we either have to copy them into another string or need a way to represent substrings. Both are easy to do, but the more interesting one is representing and working with substrings, so in this chapter, we will experiment with a string representation that can handle this. We will not implement a complete library for an alternative string representation, but enough to work as a starting point if it is something you will later wish to do.