On Tue, 14 Oct 2014 19:46:57 +0000 jicman via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote:
> char[] s = "ABCabc"; > foreach (char c; s) > { > // how do I convert c to something an Unicode code? ie. \u9999. > > } string res; foreach (dchar ch; s) res ~= "\\u%04X".format(ch); // here we have the result in res note "dchar" instead of "char". with "dchar" foreach() does utf-8 decoding (as 's' is in utf-8).
signature.asc
Description: PGP signature