retro() on a `string` creates a range of `dchar`, causing array() pains

Jakob Ovrum jakobovrum at gmail.com
Tue Apr 17 22:45:04 PDT 2012


On Tuesday, 17 April 2012 at 15:36:39 UTC, Ali Çehreli wrote:
>
> The reason is, a sequence of UTF-8 code units are not a valid 
> UTF-8 when reversed (or retro'ed :p). But a dchar array can be 
> reversed.
>
> Ali

It is absolutely possible to walk a UTF-8 string backwards.

The problem here is that arrays of char are ranges of dchar; 
hence you can't go the regular generic path and have to use 
text() instead.


More information about the Digitalmars-d-learn mailing list