D-Programming-Language/phobos — pull request #738 by jmdavis (2012-08-05 07:00:12+00:00)
Title: Made stride, strideBack, and decode work with ranges of code units.

They're needed for something like a lexer which needs to operate on
arbitrary ranges of code units rather than code points.

I also added versions of stride and strideBack which don't require an
index (and operate on the first and last index of the range
respectively) as well as decodeFront for decoding the first code point
in the range (unlike stride and strideBack, it needs its own name,
because its signature is more or less identical to decode's signature -
the only difference is that its index is out instead of ref).

Sorry that the diff looks so funny (you may just want to look at the [actual code](https://github.com/jmdavis/phobos/blob/feb50f01da2e350bd2684daf51a210eba6d8a909/std/utf.d) for `stride`, `strideBack`, and `decode` - particularly for `decode`), but there's a fair bit of stuff that's almost the same but not quite, so the additions and removals get lined up kind of funny in some places - particularly for `decode`, because I merged the `char`, `wchar`, and `dchar` versions into one, and ended up having to create some string mixins to avoid code duplication between strings and ranges.