the mangled name
A string. If it is not a D mangled name, it returns its argument name.
// int b in module a assert(demangle("_D1a1bi") == "int a.b"); // char array foo in module test assert(demangle("_D4test3fooAa") == "char[] test.foo");
This program reads standard in and writes it to standard out, pretty-printing any found D mangled names.
1 import std.ascii : isAlphaNum; 2 import std.algorithm.iteration : chunkBy, joiner, map; 3 import std.algorithm.mutation : copy; 4 import std.conv : to; 5 import std.demangle : demangle; 6 import std.functional : pipe; 7 import std.stdio : stdin, stdout; 8 9 void main() 10 { 11 stdin.byLineCopy 12 .map!( 13 l => l.chunkBy!(a => isAlphaNum(a) || a == '_') 14 .map!(a => a[1].pipe!(to!string, demangle)).joiner 15 ) 16 .copy(stdout.lockingTextWriter); 17 }
Demangle D mangled names.