The length of strings vs. # of chars vs. sizeof
Rainer Deyke
rainerd at eldwood.com
Sun Nov 1 19:00:21 PST 2009
Jérôme M. Berger wrote:
> Rainer Deyke wrote:
>> Strings are just arrays of code units. Their length is the number of
>> elements (i.e. code units) they contain, just like other arrays. A code
>> point may comprise multiple code units, and a logical character may
>> comprise multiple code points. The latter is true even with
>> dchar/utf-32.
>>
> So, in UTF-8, length is the number of bytes in the string and sizeof
> is 8 (on 32-bits systems).
Yes.
--
Rainer Deyke - rainerd at eldwood.com
More information about the Digitalmars-d-learn
mailing list