Why is string.front dchar?

Jonathan M Davis jmdavisProg at gmx.com
Mon Jan 13 19:01:28 PST 2014


On Monday, January 13, 2014 23:10:03 TheFlyingFiddle wrote:
> I'm curious, why is the .front property of narrow strings of type
> dchar?
> And not the underlying character type for the string.

It's to promote the correct handling of Unicode. A couple of related questions 
and answers:

http://stackoverflow.com/questions/12288465/std-algorithm-joinerstring-string-why-result-elements-are-dchar-and-not-ch

http://stackoverflow.com/questions/16590650/how-to-read-a-string-character-by-character-as-a-range-in-d

- Jonathan M Davis


More information about the Digitalmars-d-learn mailing list