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

The Best Web Trends of the Decade

A look back at the best innovations, ideas and technologies over the last 10 years, 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

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

All rights reserved.