|No problem: the iterator is a pointer in a UTF-8 encoded string and the function (called
next) has to advance to the next code point (1, 2, 3 or 4
char). If iterator is at end of string it doesn't advance.
Although a very simple function, I had a number of design decisions to make:
- How should I deal with improperly encoded UTF-8 strings? I decided to return
false if the string is not properly encoded.
- Should I just leave out the boundary check and just document it? I decided against as it would have been unsafe.
And the last one I was asking about: For limit check, should I just pass the string or the end iterator.