how to get the \uxxxx unicode code from a char

Brad Anderson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Oct 14 13:05:05 PDT 2014


On Tuesday, 14 October 2014 at 20:03:37 UTC, jicman wrote:
> On Tuesday, 14 October 2014 at 19:49:16 UTC, Sean Kelly wrote:
>> On Tuesday, 14 October 2014 at 19:47:00 UTC, jicman wrote:
>>>
>>> Greetings.
>>>
>>> Imagine this code,
>>>
>>> char[] s = "ABCabc";
>>> foreach (char c; s)
>>> {
>>> // how do I convert c to something an Unicode code? ie. 
>>> \u9999.
>>>
>>> }
>>
>> I'd look at the JSON string encoder.
>
> JSON?  What does JSON has to do with my basic D? :-) No thanks. 
> :-)

Sean's saying that the JSON encoder does the same thing so you 
can look there for how to do it.

https://github.com/D-Programming-Language/phobos/blob/master/std/json.d#L579


More information about the Digitalmars-d-learn mailing list