The Road to Delphi

Delphi – Free Pascal – Oxygene

Convert String to Enum using Delphi Prism

Leave a comment

To convert a string in a Enum type, you can use the Enum.Parse function.

See this example

type
  Language = (Delphi,Delphi_Prism,CBuilder);

  var  aLanguage  : Language := Language(Enum.Parse(typeof(Language), 'Delphi', true));

Unknown's avatar

Author: Rodrigo

Just another Delphi guy.

Leave a comment