Odd behaviour of std.range
Ali Çehreli
acehreli at yahoo.com
Tue Feb 22 17:55:01 UTC 2022
On 2/22/22 09:25, frame wrote:
> Well, I think it's ok for strings but it shouldn't do it for simple
> arrays
string is a simple array as well just with immutable(char) as elements.
It is just an alias:
alias string = immutable(char)[];
> where it's intentional that I want to process the character and
> not a UTF-8 codepoint.
I understand how auto decoding can be bad but I doubt you need to
process a char. char is a UTF-8 code unit, likely one of multiple bytes
that represent a Unicode character; an information encoding byte, not
the information. That code unit includes encoding bits that tell the
decoder whether it is the first character or a continuation character.
Not many programmer will ever need to write code to decode UTF-8.
Ali
More information about the Digitalmars-d-learn
mailing list