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

Ali Çehreli acehreli at yahoo.com
Wed Apr 18 06:34:13 PDT 2012


On Wednesday, 18 April 2012 at 05:45:06 UTC, Jakob Ovrum wrote:
 > 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.

Indeed. I didn't mean otherwise. I was trying to explain why "The type 
of the return expression is dstring, not string."

And I just checked, again, that my use of "UTF-8 code units" above was 
correct. :) I didn't say "Unicode code points".

Ali



More information about the Digitalmars-d-learn mailing list