String Type Usage. String vs DString vs WString
rikki cattermole
rikki at cattermole.co.nz
Mon Jan 15 02:09:25 UTC 2018
On 15/01/2018 2:05 AM, Chris P wrote:
> Hello,
>
> I'm extremely new to D and have a quick question regarding common
> practice when using strings. Is usage of one type over the others
> encouraged? When using 'string' it appears there is a length mismatch
> between the string length and the char array if large Unicode characters
> are used. So I figured I'd ask.
>
> Thanks in advance,
>
> Chris P - Tampa
D's strings are Unicode.
Unicode has three main variants, UTF-8, UTF-16 and UTF-32.
The size of a code point is 1, 2 or 4 bytes.
But here is the thing, what is displayed (a character) could be multiple
code points and these can be combined to form a grapheme.
So yes, there will be length mismatches between them :)
More information about the Digitalmars-d-learn
mailing list