Inconsitency

nickles ben at world-of-ben.de
Sun Oct 13 06:14:58 PDT 2013


> This is simply wrong. All strings return number of codeunits. 
> And it's only UTF-32 where codepoint (~ character) happens to 
> fit into one codeunit.

I do not agree:

    writeln("säд".length);        => 5  chars: 5 (1 + 2 [C3A4] + 2 
[D094], UTF-8)
    writeln(std.utf.count("säд")) => 3  chars: 5 (ibidem)
    writeln("säд"w.length);       => 3  chars: 6 (2 x 3, UTF-16)
    writeln("säд"d.length);       => 3  chars: 12 (4 x 3, UTF-32)

This is not consistent - from my point of view.


More information about the Digitalmars-d mailing list