1. Home
  2. Computing & Technology
  3. Delphi Programming

Delphi Enum to String

By , About.com Guide

Here's how to display the string represention of a Delphi enum type at runtime.

~~~~~~~~~~~~~~~~~~~~~~~~~
{
Suppose enum:

TProgrammerType = (tpDelphi, tpVisualC, tpVB, tpJava) ;
}

uses TypInfo;
var s: string;
s := GetEnumName(TypeInfo(TProgrammerType),
                  integer(tpDelphi)) ;

//s='tpDelphi'

~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» How to install an INF file using Delphi
« Using an object with no reference variable

Explore Delphi Programming
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2003 Delphi Tips
  7. Delphi Enum to String

©2009 About.com, a part of The New York Times Company.

All rights reserved.