Menu

- Learn
- Documentation
  - Language Reference
  - Library Reference
  - Command-line Reference
  - Feature Overview
  - Articles
- Packages
- Community
  - Blog
  - Orgs using D
  - Twitter
  - Forums
  - IRC
  - Wiki
  - GitHub
  - Issues
  - Get involved
  - Foundation
  - Donate
- Resources
  - Books
  - Tutorials
  - Tools
  - Editors
  - IDEs
  - Visual D
  - Acknowledgments
  - D Style
  - Glossary
  - Sitemap

Search
Report a bug
If you spot a problem with this page, click here to create a Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page. Requires a signed-in GitHub account. This works well for small changes. If you'd like to make larger changes you may want to consider using a local clone.

# std.demangle

Demangle D mangled names.
License:
Boost License 1.0.
Authors:
Walter Bright, Thomas Kühne, Frits van Bommel

Source std/demangle.d

string `demangle`(string `name`);
  Demangle D mangled names.
  If it is not a D mangled `name`, it returns its argument `name`.

  Example This program reads standard in and writes it to standard out, pretty-printing any found D mangled names.

      import core.stdc.stdio : stdin;
      import std.stdio;
      import std.ascii;
      import std.demangle;

      void test(int x, float y) { }

      int main()
      {
          string buffer;
          bool inword;
          int c;

          writefln("Try typing in: %s", test.mangleof);
          while ((c = fgetc(stdin)) != EOF)
          {
              if (inword)
              {
                  if (c == '_' || isAlphaNum(c))
                      buffer ~= cast(char) c;
                  else
                  {
                      inword = false;
                      write(demangle(buffer), cast(char) c);
                  }
              }
              else
              {   if (c == '_' || isAlpha(c))
                  {
                      inword = true;
                      buffer.length = 0;
                      buffer ~= cast(char) c;
                  }
                  else
                      write(cast(char) c);
              }
          }
          if (inword)
              write(demangle(buffer));
          return 0;
      }

Copyright © 1999-2017 by the D Language Foundation | Page generated by Ddoc on Wed Nov 1 23:25:07 2017