Why string alias is invariant ?

Sean Kelly sean at f4.ca
Thu Jan 31 12:38:51 PST 2008


Janice Caron wrote:
> On 1/31/08, Sean Kelly <sean at f4.ca> wrote:
> 
>>> and the duplication goes away.
>> It does?  I didn't think tolower would modify a string in place.
> 
> OK - /one/ of the duplications goes away.
> 
> It's not possible, even in principle, to lowercase a char[] in place,
> because a char[] by definition is an array of UTF-8 code units, /not/
> an array of characters. Lowercasing a character may result in the
> length of its UTF-8 sequence changing. If the length increases, you're
> screwed.
> 
> You can lowercase a dchar[] in place, but not a char[].

Ah, good point.


Sean



More information about the Digitalmars-d mailing list