string to character code hex string

bitwise via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Sep 2 13:02:37 PDT 2017


On Saturday, 2 September 2017 at 18:28:02 UTC, Moritz Maxeiner 
wrote:
> 
> In UTF8:
>
> --- utfmangle.d ---
> void fun_ༀ() {}
> pragma(msg, fun_ༀ.mangleof);
> -------------------
>
> ---
> $ dmd -c utfmangle.d
> _D6mangle7fun_ༀFZv
> ---
>
> Only universal character names for identifiers are allowed, 
> though, as per [1]
>
> [1] https://dlang.org/spec/lex.html#identifiers

What I intend to do is this though:

void fun(string s)() {}
pragma(msg, fun!"ༀ".mangleof);

which gives:
_D7mainMod21__T3funVAyaa3_e0bc80Z3funFNaNbNiNfZv

where "e0bc80" is the 3 bytes of "ༀ".

The function will be internal to my library. The only thing 
provided from outside will be the string template argument, which 
is meant to represent a fully qualified type name.




More information about the Digitalmars-d-learn mailing list