Some questions about strings

Denis noreply at noserver.lan
Mon Jun 22 04:08:10 UTC 2020


On Monday, 22 June 2020 at 03:31:17 UTC, Ali Çehreli wrote:
:
> string is char[]
> wstring is wchar[]
> dstring is dchar[]

Got it now. This is the critical piece I missed: I understand the 
relations between the char types and the UTF encodings (thanks to 
your book). But I mistakenly thought that the string types were 
different.

> You can reveal some of the mystery by looking at their .length 
> property. Additionally, foreach will visit these types 
> element-by-element: char, wchar, and dchar, respectively.

I did not try this test -- my bad.

> null character is not required but may be a part of the strings.

The terminating null character was one of the reasons I thought 
strings were different from char arrays. Now I know better.

Thank you for these clarifications.
Denis


More information about the Digitalmars-d-learn mailing list