Characters in D

Adam D. Ruppe destructionator at gmail.com
Sat Nov 2 15:54:02 UTC 2019


On Saturday, 2 November 2019 at 15:44:49 UTC, Eugene wrote:
> "Variable of type char can only hold letters that are in the 
> ASCII table". (section 15.4 Character literals)
> So why there is executed next code?

The individual char can only hold those, but a group of chars can 
hold anything.

> char[] cyrillics = "привет".dup;

this works because the "string" has multi-char groupings

> char[] cyrillics = ['п', 'р', 'и', 'в', 'е', 'т']; //not

and this doesn't because you are specifying individual items 
there so it can't just spread them across multiple bytes




More information about the Digitalmars-d mailing list