String Type Usage. String vs DString vs WString

Chris P a at b.com
Mon Jan 15 02:22:09 UTC 2018


On Monday, 15 January 2018 at 02:15:55 UTC, Nicholas Wilson wrote:
> On Monday, 15 January 2018 at 02:05:32 UTC, Chris P wrote:
>> [...]
>
>  string == immutable( char)[], char == utf8
> wstring == immutable(wchar)[], char == utf16
> dstring == immutable(dchar)[], char == utf32
>
> Unless you are dealing with windows, in which case you way need 
> to consider using wstring, there is very little reason to use 
> anything but string.
>
> N.B. when you iterate over a string there are a number of 
> different "flavours" (for want of a better term) you can 
> iterate over, bytes, unicode codepoints and graphemes ( I'm 
> possible forgetting some). have a look in std.uni and related 
> modules. Iteration in Phobos defaults to coepoints I think.
>
> TLDR use string.

Thank you (and rikki) for replying. Actually, I am using Windows 
(Doh!) but I now understand. Cheers!


More information about the Digitalmars-d-learn mailing list