Regarding hex strings

Don Clugston dac at nospam.com
Fri Oct 19 08:07:43 PDT 2012


On 19/10/12 16:07, foobar wrote:
> On Friday, 19 October 2012 at 13:19:09 UTC, Don Clugston wrote:
>>>
>>> We can still have both (assuming the code points are valid...):
>>> string foo = "\ua1\ub2\uc3"; // no .dup
>>
>> That doesn't compile.
>> Error: escape hex sequence has 2 hex digits instead of 4
>
> Come on, "assuming the code points are valid". It says so 4 lines above!

It isn't the same.
Hex strings are the raw bytes, eg UTF8 code points. (ie, it includes the 
high bits that indicate the length of each char).
\u makes dchars.

"\u00A1" is not the same as x"A1" nor is it x"00 A1". It's two non-zero 
bytes.


More information about the Digitalmars-d mailing list